pulsatrix 1.1.0
Loading...
Searching...
No Matches
json_schema.hpp
Go to the documentation of this file.
1
24#pragma once
25
26#include <cstddef>
27#include <string>
28#include <vector>
29
30#include "pulsatrix/json.hpp"
31
32namespace pulsatrix::orch {
33
37 std::string path;
38 std::string message;
39};
40
45void CheckSchema(const JsonValue& schema);
46
54[[nodiscard]] std::vector<SchemaError> ValidateJson(const JsonValue& schema, const JsonValue& value,
55 std::size_t max_errors = 16);
56
65[[nodiscard]] std::string StrictModeProblem(const JsonValue& schema);
66
69[[nodiscard]] bool JsonEquals(const JsonValue& a, const JsonValue& b);
70
71} // namespace pulsatrix::orch
One JSON value: null, a boolean, a number, a string, an array or an object.
Definition json.hpp:22
A small strict JSON value, parser and deterministic writer (RFC 8259).
Definition http.hpp:20
void CheckSchema(const JsonValue &schema)
Checks that schema uses only the supported keywords, each with a valid value.
bool JsonEquals(const JsonValue &a, const JsonValue &b)
JSON equality, as enum, const and uniqueItems use it: numbers by value (1 equals 1....
std::string StrictModeProblem(const JsonValue &schema)
Why schema can't be used with Anthropic's strict tool use, or "" if it can.
std::vector< SchemaError > ValidateJson(const JsonValue &schema, const JsonValue &value, std::size_t max_errors=16)
Checks value against schema.
One way a value fails a schema.
Definition json_schema.hpp:35
std::string message
Definition json_schema.hpp:38
std::string path
Where, as a JSON Pointer into the value: "" for the whole value, /items/0/name.
Definition json_schema.hpp:37