| 431 | } |
| 432 | |
| 433 | void draft_07_example() |
| 434 | { |
| 435 | json schema = json::parse(R"( |
| 436 | { |
| 437 | "items": [{}], |
| 438 | "additionalItems": {"type": "integer"} |
| 439 | } |
| 440 | )"); |
| 441 | |
| 442 | // Need to supply default version because schema does not have $schema keyword |
| 443 | auto options = jsonschema::evaluation_options{} |
| 444 | .default_version(jsonschema::schema_version::draft7()); |
| 445 | auto compiled = jsonschema::make_json_schema(schema, options); |
| 446 | |
| 447 | json data = json::parse(R"([ null, 2, 3, "foo" ])"); |
| 448 | |
| 449 | jsoncons::json_decoder<ojson> decoder; |
| 450 | compiled.validate(data, decoder); |
| 451 | ojson output = decoder.get_result(); |
| 452 | std::cout << pretty_print(output) << "\n\n"; |
| 453 | } |
| 454 | |
| 455 | void cross_schema_example() |
| 456 | { |
no test coverage detected