|
6 | 6 | { |
7 | 7 | "description": "oneOf", |
8 | 8 | "schema": { |
9 | | - "oneOf": [ |
10 | | - { "type": "string" }, |
11 | | - { "type": "number" } |
12 | | - ] |
| 9 | + "oneOf": [{ "type": "string" }, { "type": "number" }] |
13 | 10 | }, |
14 | 11 | "instance": null, |
15 | 12 | "errors": [ |
|
46 | 43 | { |
47 | 44 | "description": "oneOf more than one match", |
48 | 45 | "schema": { |
49 | | - "oneOf": [ |
50 | | - { "type": "integer" }, |
51 | | - { "type": "number" } |
52 | | - ] |
| 46 | + "oneOf": [{ "type": "integer" }, { "type": "number" }] |
53 | 47 | }, |
54 | 48 | "instance": 1, |
55 | 49 | "errors": [ |
|
100 | 94 | ] |
101 | 95 | }, |
102 | 96 | { |
103 | | - "description": "oneOf pass", |
| 97 | + "description": "oneOf more than one match with an additional failing alternative", |
104 | 98 | "schema": { |
105 | 99 | "oneOf": [ |
106 | 100 | { "type": "string" }, |
|
272 | 266 | ] |
273 | 267 | } |
274 | 268 | ] |
| 269 | + }, |
| 270 | + { |
| 271 | + "description": "oneOf more than one match with success explanations", |
| 272 | + "schema": { |
| 273 | + "oneOf": [{ "type": "integer" }, { "type": "number" }] |
| 274 | + }, |
| 275 | + "instance": 66, |
| 276 | + "errors": [ |
| 277 | + { |
| 278 | + "messageId": "oneOf-message", |
| 279 | + "messageParams": { "matchCount": 2 }, |
| 280 | + "alternatives": [ |
| 281 | + [ |
| 282 | + { |
| 283 | + "messageId": "type-success", |
| 284 | + "messageParams": { |
| 285 | + "actualType": "integer" |
| 286 | + }, |
| 287 | + "instanceLocation": "#", |
| 288 | + "schemaLocations": ["#/oneOf/0/type"] |
| 289 | + } |
| 290 | + ], |
| 291 | + [ |
| 292 | + { |
| 293 | + "messageId": "type-success", |
| 294 | + "messageParams": { |
| 295 | + "actualType": "number" |
| 296 | + }, |
| 297 | + "instanceLocation": "#", |
| 298 | + "schemaLocations": ["#/oneOf/1/type"] |
| 299 | + } |
| 300 | + ] |
| 301 | + ], |
| 302 | + "instanceLocation": "#", |
| 303 | + "schemaLocations": ["#/oneOf"] |
| 304 | + } |
| 305 | + ] |
| 306 | + }, |
| 307 | + { |
| 308 | + "description": "oneOf more than one match with failed alternatives ignored", |
| 309 | + "schema": { |
| 310 | + "oneOf": [ |
| 311 | + { "required": ["a"] }, |
| 312 | + { "required": ["b"] }, |
| 313 | + { "required": ["c"] } |
| 314 | + ] |
| 315 | + }, |
| 316 | + "instance": { "a": 1, "b": 2 }, |
| 317 | + "errors": [ |
| 318 | + { |
| 319 | + "messageId": "oneOf-message", |
| 320 | + "messageParams": { "matchCount": 2 }, |
| 321 | + "alternatives": [ |
| 322 | + [ |
| 323 | + { |
| 324 | + "messageId": "required-success", |
| 325 | + "messageParams": { |
| 326 | + "property": "a" |
| 327 | + }, |
| 328 | + "instanceLocation": "#", |
| 329 | + "schemaLocations": ["#/oneOf/0/required"] |
| 330 | + } |
| 331 | + ], |
| 332 | + [ |
| 333 | + { |
| 334 | + "messageId": "required-success", |
| 335 | + "messageParams": { |
| 336 | + "property": "b" |
| 337 | + }, |
| 338 | + "instanceLocation": "#", |
| 339 | + "schemaLocations": ["#/oneOf/1/required"] |
| 340 | + } |
| 341 | + ] |
| 342 | + ], |
| 343 | + "instanceLocation": "#", |
| 344 | + "schemaLocations": ["#/oneOf"] |
| 345 | + } |
| 346 | + ] |
| 347 | + }, |
| 348 | + { |
| 349 | + "description": "nested oneOf producing multiple matches in inner oneOf", |
| 350 | + "schema": { |
| 351 | + "oneOf": [ |
| 352 | + { |
| 353 | + "oneOf": [{ "required": ["a"] }, { "required": ["b"] }] |
| 354 | + }, |
| 355 | + { "required": ["c"] } |
| 356 | + ] |
| 357 | + }, |
| 358 | + "instance": { "a": 1, "b": 2 }, |
| 359 | + "errors": [ |
| 360 | + { |
| 361 | + "messageId": "oneOf-message", |
| 362 | + "messageParams": { "matchCount": 2 }, |
| 363 | + "instanceLocation": "#", |
| 364 | + "schemaLocations": ["#/oneOf/0/oneOf"], |
| 365 | + "alternatives": [ |
| 366 | + [ |
| 367 | + { |
| 368 | + "messageId": "required-success", |
| 369 | + "messageParams": { "property": "a" }, |
| 370 | + "instanceLocation": "#", |
| 371 | + "schemaLocations": ["#/oneOf/0/oneOf/0/required"] |
| 372 | + } |
| 373 | + ], |
| 374 | + [ |
| 375 | + { |
| 376 | + "messageId": "required-success", |
| 377 | + "messageParams": { "property": "b" }, |
| 378 | + "instanceLocation": "#", |
| 379 | + "schemaLocations": ["#/oneOf/0/oneOf/1/required"] |
| 380 | + } |
| 381 | + ] |
| 382 | + ] |
| 383 | + } |
| 384 | + ] |
275 | 385 | } |
276 | 386 | ] |
277 | 387 | } |
0 commit comments