| 401 | } |
| 402 | |
| 403 | void draft_201909_example() |
| 404 | { |
| 405 | json schema = json::parse(R"( |
| 406 | { |
| 407 | "$schema": "https://json-schema.org/draft/2019-09/schema", |
| 408 | "type": "object", |
| 409 | "properties": { |
| 410 | "foo": { "type": "string" } |
| 411 | }, |
| 412 | "allOf": [ |
| 413 | { |
| 414 | "properties": { |
| 415 | "bar": { "type": "string" } |
| 416 | } |
| 417 | } |
| 418 | ], |
| 419 | "unevaluatedProperties": false |
| 420 | } |
| 421 | )"); |
| 422 | |
| 423 | jsonschema::json_schema<json> compiled = jsonschema::make_json_schema(schema); |
| 424 | |
| 425 | json data = json::parse(R"({"foo": "foo","bar": "bar","baz": "baz"})"); |
| 426 | |
| 427 | jsoncons::json_decoder<ojson> decoder; |
| 428 | compiled.validate(data, decoder); |
| 429 | ojson output = decoder.get_result(); |
| 430 | std::cout << pretty_print(output) << "\n\n"; |
| 431 | } |
| 432 | |
| 433 | void draft_07_example() |
| 434 | { |
no test coverage detected