cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/external/tests/draft4/additionalItems.json (about) 1 [ 2 { 3 "description": "additionalItems as schema", 4 "schema": { 5 "items": [ 6 {} 7 ], 8 "additionalItems": { 9 "type": "integer" 10 } 11 }, 12 "tests": [ 13 { 14 "description": "additional items match schema", 15 "data": [ 16 null, 17 2, 18 3, 19 4 20 ], 21 "valid": true 22 }, 23 { 24 "description": "additional items do not match schema", 25 "data": [ 26 null, 27 2, 28 3, 29 "foo" 30 ], 31 "valid": false 32 } 33 ] 34 }, 35 { 36 "description": "when items is schema, additionalItems does nothing", 37 "schema": { 38 "items": {}, 39 "additionalItems": false 40 }, 41 "tests": [ 42 { 43 "description": "all items match schema", 44 "data": [ 45 1, 46 2, 47 3, 48 4, 49 5 50 ], 51 "valid": true 52 } 53 ] 54 }, 55 { 56 "description": "array of items with no additionalItems permitted", 57 "schema": { 58 "items": [ 59 {}, 60 {}, 61 {} 62 ], 63 "additionalItems": false 64 }, 65 "tests": [ 66 { 67 "description": "empty array", 68 "data": [], 69 "valid": true, 70 "skip": { 71 "v2": "5 errors in empty disjunction:\nconflicting values [] and {...} (mismatched types list and struct):\n generated.cue:2:1\n generated.cue:2:45\n instance.json:1:1\nconflicting values bool and [] (mismatched types bool and list):\n generated.cue:2:8\n instance.json:1:1\nconflicting values null and [] (mismatched types null and list):\n generated.cue:2:1\n instance.json:1:1\nconflicting values number and [] (mismatched types number and list):\n generated.cue:2:15\n instance.json:1:1\nconflicting values string and [] (mismatched types string and list):\n generated.cue:2:24\n instance.json:1:1\n", 72 "v3": "6 errors in empty disjunction:\nconflicting values [] and bool (mismatched types list and bool):\n generated.cue:2:8\n instance.json:1:1\nconflicting values [] and null (mismatched types list and null):\n generated.cue:2:1\n instance.json:1:1\nconflicting values [] and number (mismatched types list and number):\n generated.cue:2:15\n instance.json:1:1\nconflicting values [] and string (mismatched types list and string):\n generated.cue:2:24\n instance.json:1:1\nconflicting values [] and {...} (mismatched types list and struct):\n generated.cue:2:45\n instance.json:1:1\nincompatible list lengths (0 and 3):\n generated.cue:2:33\n" 73 } 74 }, 75 { 76 "description": "fewer number of items present (1)", 77 "data": [ 78 1 79 ], 80 "valid": true, 81 "skip": { 82 "v2": "5 errors in empty disjunction:\nconflicting values [1] and {...} (mismatched types list and struct):\n generated.cue:2:1\n generated.cue:2:45\n instance.json:1:1\nconflicting values bool and [1] (mismatched types bool and list):\n generated.cue:2:8\n instance.json:1:1\nconflicting values null and [1] (mismatched types null and list):\n generated.cue:2:1\n instance.json:1:1\nconflicting values number and [1] (mismatched types number and list):\n generated.cue:2:15\n instance.json:1:1\nconflicting values string and [1] (mismatched types string and list):\n generated.cue:2:24\n instance.json:1:1\n", 83 "v3": "6 errors in empty disjunction:\nconflicting values [1] and bool (mismatched types list and bool):\n generated.cue:2:8\n instance.json:1:1\nconflicting values [1] and null (mismatched types list and null):\n generated.cue:2:1\n instance.json:1:1\nconflicting values [1] and number (mismatched types list and number):\n generated.cue:2:15\n instance.json:1:1\nconflicting values [1] and string (mismatched types list and string):\n generated.cue:2:24\n instance.json:1:1\nconflicting values [1] and {...} (mismatched types list and struct):\n generated.cue:2:45\n instance.json:1:1\nincompatible list lengths (1 and 3):\n generated.cue:2:33\n" 84 } 85 }, 86 { 87 "description": "fewer number of items present (2)", 88 "data": [ 89 1, 90 2 91 ], 92 "valid": true, 93 "skip": { 94 "v2": "5 errors in empty disjunction:\nconflicting values [1,2] and {...} (mismatched types list and struct):\n generated.cue:2:1\n generated.cue:2:45\n instance.json:1:1\nconflicting values bool and [1,2] (mismatched types bool and list):\n generated.cue:2:8\n instance.json:1:1\nconflicting values null and [1,2] (mismatched types null and list):\n generated.cue:2:1\n instance.json:1:1\nconflicting values number and [1,2] (mismatched types number and list):\n generated.cue:2:15\n instance.json:1:1\nconflicting values string and [1,2] (mismatched types string and list):\n generated.cue:2:24\n instance.json:1:1\n", 95 "v3": "6 errors in empty disjunction:\nconflicting values [1,2] and bool (mismatched types list and bool):\n generated.cue:2:8\n instance.json:1:1\nconflicting values [1,2] and null (mismatched types list and null):\n generated.cue:2:1\n instance.json:1:1\nconflicting values [1,2] and number (mismatched types list and number):\n generated.cue:2:15\n instance.json:1:1\nconflicting values [1,2] and string (mismatched types list and string):\n generated.cue:2:24\n instance.json:1:1\nconflicting values [1,2] and {...} (mismatched types list and struct):\n generated.cue:2:45\n instance.json:1:1\nincompatible list lengths (2 and 3):\n generated.cue:2:33\n" 96 } 97 }, 98 { 99 "description": "equal number of items present", 100 "data": [ 101 1, 102 2, 103 3 104 ], 105 "valid": true 106 }, 107 { 108 "description": "additional items are not permitted", 109 "data": [ 110 1, 111 2, 112 3, 113 4 114 ], 115 "valid": false 116 } 117 ] 118 }, 119 { 120 "description": "additionalItems as false without items", 121 "schema": { 122 "additionalItems": false 123 }, 124 "tests": [ 125 { 126 "description": "items defaults to empty schema so everything is valid", 127 "data": [ 128 1, 129 2, 130 3, 131 4, 132 5 133 ], 134 "valid": true 135 }, 136 { 137 "description": "ignores non-arrays", 138 "data": { 139 "foo": "bar" 140 }, 141 "valid": true 142 } 143 ] 144 }, 145 { 146 "description": "additionalItems are allowed by default", 147 "schema": { 148 "items": [ 149 { 150 "type": "integer" 151 } 152 ] 153 }, 154 "tests": [ 155 { 156 "description": "only the first item is validated", 157 "data": [ 158 1, 159 "foo", 160 false 161 ], 162 "valid": true 163 } 164 ] 165 }, 166 { 167 "description": "additionalItems does not look in applicators, valid case", 168 "schema": { 169 "allOf": [ 170 { 171 "items": [ 172 { 173 "type": "integer" 174 } 175 ] 176 } 177 ], 178 "additionalItems": { 179 "type": "boolean" 180 } 181 }, 182 "tests": [ 183 { 184 "description": "items defined in allOf are not examined", 185 "data": [ 186 1, 187 null 188 ], 189 "valid": true 190 } 191 ] 192 }, 193 { 194 "description": "additionalItems does not look in applicators, invalid case", 195 "schema": { 196 "allOf": [ 197 { 198 "items": [ 199 { 200 "type": "integer" 201 }, 202 { 203 "type": "string" 204 } 205 ] 206 } 207 ], 208 "items": [ 209 { 210 "type": "integer" 211 } 212 ], 213 "additionalItems": { 214 "type": "boolean" 215 } 216 }, 217 "tests": [ 218 { 219 "description": "items defined in allOf are not examined", 220 "data": [ 221 1, 222 "hello" 223 ], 224 "valid": false 225 } 226 ] 227 }, 228 { 229 "description": "items validation adjusts the starting index for additionalItems", 230 "schema": { 231 "items": [ 232 { 233 "type": "string" 234 } 235 ], 236 "additionalItems": { 237 "type": "integer" 238 } 239 }, 240 "tests": [ 241 { 242 "description": "valid items", 243 "data": [ 244 "x", 245 2, 246 3 247 ], 248 "valid": true 249 }, 250 { 251 "description": "wrong type of second item", 252 "data": [ 253 "x", 254 "y" 255 ], 256 "valid": false 257 } 258 ] 259 }, 260 { 261 "description": "additionalItems with heterogeneous array", 262 "schema": { 263 "items": [ 264 {} 265 ], 266 "additionalItems": false 267 }, 268 "tests": [ 269 { 270 "description": "heterogeneous invalid instance", 271 "data": [ 272 "foo", 273 "bar", 274 37 275 ], 276 "valid": false 277 }, 278 { 279 "description": "valid instance", 280 "data": [ 281 null 282 ], 283 "valid": true 284 } 285 ] 286 }, 287 { 288 "description": "additionalItems with null instance elements", 289 "schema": { 290 "additionalItems": { 291 "type": "null" 292 } 293 }, 294 "tests": [ 295 { 296 "description": "allows null elements", 297 "data": [ 298 null 299 ], 300 "valid": true 301 } 302 ] 303 } 304 ]