| 19 | namespace jsonpatch = jsoncons::jsonpatch; |
| 20 | |
| 21 | void validate_three_ways() |
| 22 | { |
| 23 | std::string schema_str = R"( |
| 24 | { |
| 25 | "$id": "https://example.com/arrays.schema.json", |
| 26 | "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 27 | "description": "Arrays of strings and objects", |
| 28 | "type": "object", |
| 29 | "properties": { |
| 30 | "fruits": { |
| 31 | "type": "array", |
| 32 | "items": { |
| 33 | "type": "string" |
| 34 | } |
| 35 | }, |
| 36 | "vegetables": { |
| 37 | "type": "array", |
| 38 | "items": { "$ref": "#/$defs/veggie" } |
| 39 | } |
| 40 | }, |
| 41 | "$defs": { |
| 42 | "veggie": { |
| 43 | "type": "object", |
| 44 | "required": [ "veggieName", "veggieLike" ], |
| 45 | "properties": { |
| 46 | "veggieName": { |
| 47 | "type": "string", |
| 48 | "description": "The name of the vegetable." |
| 49 | }, |
| 50 | "veggieLike": { |
| 51 | "type": "boolean", |
| 52 | "description": "Do I like this vegetable?" |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | )"; |
| 59 | |
| 60 | std::string data_str = R"( |
| 61 | { |
| 62 | "fruits": [ "apple", "orange", "pear" ], |
| 63 | "vegetables": [ |
| 64 | { |
| 65 | "veggieName": "potato", |
| 66 | "veggieLike": true |
| 67 | }, |
| 68 | { |
| 69 | "veggieName": "broccoli", |
| 70 | "veggieLike": "false" |
| 71 | }, |
| 72 | { |
| 73 | "veggieName": "carrot", |
| 74 | "veggieLike": false |
| 75 | }, |
| 76 | { |
| 77 | "veggieName": "Swiss Chard" |
| 78 | } |
no test coverage detected