| 364 | #endif // JSONCONS_HAS_STD_VARIANT |
| 365 | |
| 366 | void draft_201212_example() |
| 367 | { |
| 368 | json schema = json::parse(R"( |
| 369 | { |
| 370 | "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 371 | "$id": "https://test.json-schema.org/typical-dynamic-resolution/root", |
| 372 | "$ref": "list", |
| 373 | "$defs": { |
| 374 | "foo": { |
| 375 | "$dynamicAnchor": "items", |
| 376 | "type": "string" |
| 377 | }, |
| 378 | "list": { |
| 379 | "$id": "list", |
| 380 | "type": "array", |
| 381 | "items": { "$dynamicRef": "#items" }, |
| 382 | "$defs": { |
| 383 | "items": { |
| 384 | "$comment": "This is only needed to satisfy the bookending requirement", |
| 385 | "$dynamicAnchor": "items" |
| 386 | } |
| 387 | } |
| 388 | } |
| 389 | } |
| 390 | } |
| 391 | )"); |
| 392 | |
| 393 | jsonschema::json_schema<json> compiled = jsonschema::make_json_schema(schema); |
| 394 | |
| 395 | json data = json::parse(R"(["foo", 42])"); |
| 396 | |
| 397 | jsoncons::json_decoder<ojson> decoder; |
| 398 | compiled.validate(data, decoder); |
| 399 | ojson output = decoder.get_result(); |
| 400 | std::cout << pretty_print(output) << "\n\n"; |
| 401 | } |
| 402 | |
| 403 | void draft_201909_example() |
| 404 | { |
no test coverage detected