| 1 | [ |
| 2 | { |
| 3 | "description": "basic schema from z-schema benchmark (https://github.com/zaggino/z-schema)", |
| 4 | "schema": { |
| 5 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 6 | "title": "Product set", |
| 7 | "type": "array", |
| 8 | "items": { |
| 9 | "title": "Product", |
| 10 | "type": "object", |
| 11 | "properties": { |
| 12 | "id": { |
| 13 | "description": "The unique identifier for a product", |
| 14 | "type": "number" |
| 15 | }, |
| 16 | "name": { |
| 17 | "type": "string" |
| 18 | }, |
| 19 | "price": { |
| 20 | "type": "number", |
| 21 | "exclusiveMinimum": 0 |
| 22 | }, |
| 23 | "tags": { |
| 24 | "type": "array", |
| 25 | "items": { |
| 26 | "type": "string" |
| 27 | }, |
| 28 | "minItems": 1, |
| 29 | "uniqueItems": true |
| 30 | }, |
| 31 | "dimensions": { |
| 32 | "type": "object", |
| 33 | "properties": { |
| 34 | "length": {"type": "number"}, |
| 35 | "width": {"type": "number"}, |
| 36 | "height": {"type": "number"} |
| 37 | }, |
| 38 | "required": ["length", "width", "height"] |
| 39 | }, |
| 40 | "warehouseLocation": { |
| 41 | "description": "Coordinates of the warehouse with the product" |
| 42 | } |
| 43 | }, |
| 44 | "required": ["id", "name", "price"] |
| 45 | } |
| 46 | }, |
| 47 | "tests": [ |
| 48 | { |
| 49 | "description": "valid array from z-schema benchmark", |
| 50 | "data": [ |
| 51 | { |
| 52 | "id": 2, |
| 53 | "name": "An ice sculpture", |
| 54 | "price": 12.5, |
| 55 | "tags": ["cold", "ice"], |
| 56 | "dimensions": { |
| 57 | "length": 7.0, |
| 58 | "width": 12.0, |
| 59 | "height": 9.5 |
| 60 | }, |
| 61 | "warehouseLocation": { |
| 62 | "latitude": -78.75, |
| 63 | "longitude": 20.4 |
| 64 | } |
| 65 | }, |
| 66 | { |
| 67 | "id": 3, |
| 68 | "name": "A blue mouse", |
| 69 | "price": 25.5, |
| 70 | "dimensions": { |
| 71 | "length": 3.1, |
| 72 | "width": 1.0, |
| 73 | "height": 1.0 |
| 74 | }, |
| 75 | "warehouseLocation": { |
| 76 | "latitude": 54.4, |
| 77 | "longitude": -32.7 |
| 78 | } |
| 79 | } |
| 80 | ], |
| 81 | "valid": true |
| 82 | }, |
| 83 | { |
| 84 | "description": "not array", |
| 85 | "data": 1, |
| 86 | "valid": false |
| 87 | }, |
| 88 | { |
| 89 | "description": "array of not onjects", |
| 90 | "data": [1, 2, 3], |
| 91 | "valid": false |
| 92 | }, |
| 93 | { |
| 94 | "description": "missing required properties", |
| 95 | "data": [{}], |
| 96 | "valid": false |
| 97 | }, |
| 98 | { |
| 99 | "description": "required property of wrong type", |
| 100 | "data": [{"id": 1, "name": "product", "price": "not valid"}], |
| 101 | "valid": false |
| 102 | }, |
| 103 | { |
| 104 | "description": "smallest valid product", |
| 105 | "data": [{"id": 1, "name": "product", "price": 100}], |
| 106 | "valid": true |
| 107 | }, |
| 108 | { |
| 109 | "description": "tags should be array", |
| 110 | "data": [{"tags": {}, "id": 1, "name": "product", "price": 100}], |
| 111 | "valid": false |
| 112 | }, |
| 113 | { |
| 114 | "description": "dimensions should be object", |
| 115 | "data": [{"dimensions": [], "id": 1, "name": "product", "price": 100}], |
| 116 | "valid": false |
| 117 | }, |
| 118 | { |
| 119 | "description": "valid product with tag", |
| 120 | "data": [{"tags": ["product"], "id": 1, "name": "product", "price": 100}], |
| 121 | "valid": true |
| 122 | }, |
| 123 | { |
| 124 | "description": "dimensions miss required properties", |
| 125 | "data": [ |
| 126 | { |
| 127 | "dimensions": {}, |
| 128 | "tags": ["product"], |
| 129 | "id": 1, |
| 130 | "name": "product", |
| 131 | "price": 100 |
| 132 | } |
| 133 | ], |
| 134 | "valid": false |
| 135 | }, |
| 136 | { |
| 137 | "description": "valid product with tag and dimensions", |
| 138 | "data": [ |
| 139 | { |
| 140 | "dimensions": {"length": 7, "width": 12, "height": 9.5}, |
| 141 | "tags": ["product"], |
| 142 | "id": 1, |
| 143 | "name": "product", |
| 144 | "price": 100 |
| 145 | } |
| 146 | ], |
| 147 | "valid": true |
| 148 | } |
| 149 | ] |
| 150 | } |
| 151 | ] |