Skip to content

Commit b45a787

Browse files
committed
Remove unnecessary type validation from unevaluatedItems tests.
For "real life" schemas, this is likely the desired behavior, but in these tests it's not what's being tested (no results depend on it) and essentially is just extra schema noise.
1 parent 39d1d24 commit b45a787

File tree

3 files changed

+22
-115
lines changed

3 files changed

+22
-115
lines changed

tests/draft-next/unevaluatedItems.json

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
[
22
{
33
"description": "unevaluatedItems true",
4-
"schema": {
5-
"type": "array",
6-
"unevaluatedItems": true
7-
},
4+
"schema": { "unevaluatedItems": true },
85
"tests": [
96
{
107
"description": "with no unevaluated items",
@@ -20,10 +17,7 @@
2017
},
2118
{
2219
"description": "unevaluatedItems false",
23-
"schema": {
24-
"type": "array",
25-
"unevaluatedItems": false
26-
},
20+
"schema": { "unevaluatedItems": false },
2721
"tests": [
2822
{
2923
"description": "with no unevaluated items",
@@ -39,10 +33,7 @@
3933
},
4034
{
4135
"description": "unevaluatedItems as schema",
42-
"schema": {
43-
"type": "array",
44-
"unevaluatedItems": { "type": "string" }
45-
},
36+
"schema": { "unevaluatedItems": { "type": "string" } },
4637
"tests": [
4738
{
4839
"description": "with no unevaluated items",
@@ -64,7 +55,6 @@
6455
{
6556
"description": "unevaluatedItems with uniform items",
6657
"schema": {
67-
"type": "array",
6858
"items": { "type": "string" },
6959
"unevaluatedItems": false
7060
},
@@ -79,7 +69,6 @@
7969
{
8070
"description": "unevaluatedItems with tuple",
8171
"schema": {
82-
"type": "array",
8372
"prefixItems": [
8473
{ "type": "string" }
8574
],
@@ -101,7 +90,6 @@
10190
{
10291
"description": "unevaluatedItems with items",
10392
"schema": {
104-
"type": "array",
10593
"prefixItems": [
10694
{ "type": "string" }
10795
],
@@ -119,7 +107,6 @@
119107
{
120108
"description": "unevaluatedItems with nested tuple",
121109
"schema": {
122-
"type": "array",
123110
"prefixItems": [
124111
{ "type": "string" }
125112
],
@@ -202,16 +189,13 @@
202189
{
203190
"description": "unevaluatedItems with nested unevaluatedItems",
204191
"schema": {
205-
"type": "array",
206192
"allOf": [
207193
{
208194
"prefixItems": [
209195
{ "type": "string" }
210196
]
211197
},
212-
{
213-
"unevaluatedItems": true
214-
}
198+
{ "unevaluatedItems": true }
215199
],
216200
"unevaluatedItems": false
217201
},
@@ -231,7 +215,6 @@
231215
{
232216
"description": "unevaluatedItems with anyOf",
233217
"schema": {
234-
"type": "array",
235218
"prefixItems": [
236219
{ "const": "foo" }
237220
],
@@ -278,7 +261,6 @@
278261
{
279262
"description": "unevaluatedItems with oneOf",
280263
"schema": {
281-
"type": "array",
282264
"prefixItems": [
283265
{ "const": "foo" }
284266
],
@@ -314,7 +296,6 @@
314296
{
315297
"description": "unevaluatedItems with not",
316298
"schema": {
317-
"type": "array",
318299
"prefixItems": [
319300
{ "const": "foo" }
320301
],
@@ -339,7 +320,6 @@
339320
{
340321
"description": "unevaluatedItems with if/then/else",
341322
"schema": {
342-
"type": "array",
343323
"prefixItems": [
344324
{ "const": "foo" }
345325
],
@@ -392,7 +372,6 @@
392372
{
393373
"description": "unevaluatedItems with boolean schemas",
394374
"schema": {
395-
"type": "array",
396375
"allOf": [true],
397376
"unevaluatedItems": false
398377
},
@@ -412,7 +391,6 @@
412391
{
413392
"description": "unevaluatedItems with $ref",
414393
"schema": {
415-
"type": "array",
416394
"$ref": "#/$defs/bar",
417395
"prefixItems": [
418396
{ "type": "string" }
@@ -447,9 +425,7 @@
447425
{
448426
"prefixItems": [ true ]
449427
},
450-
{
451-
"unevaluatedItems": false
452-
}
428+
{ "unevaluatedItems": false }
453429
]
454430
},
455431
"tests": [
@@ -463,14 +439,10 @@
463439
{
464440
"description": "item is evaluated in an uncle schema to unevaluatedItems",
465441
"schema": {
466-
"type": "object",
467442
"properties": {
468443
"foo": {
469-
"type": "array",
470444
"prefixItems": [
471-
{
472-
"type": "string"
473-
}
445+
{ "type": "string" }
474446
],
475447
"unevaluatedItems": false
476448
}
@@ -481,9 +453,7 @@
481453
"foo": {
482454
"prefixItems": [
483455
true,
484-
{
485-
"type": "string"
486-
}
456+
{ "type": "string" }
487457
]
488458
}
489459
}

tests/draft2019-09/unevaluatedItems.json

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
[
22
{
33
"description": "unevaluatedItems true",
4-
"schema": {
5-
"type": "array",
6-
"unevaluatedItems": true
7-
},
4+
"schema": { "unevaluatedItems": true },
85
"tests": [
96
{
107
"description": "with no unevaluated items",
@@ -20,10 +17,7 @@
2017
},
2118
{
2219
"description": "unevaluatedItems false",
23-
"schema": {
24-
"type": "array",
25-
"unevaluatedItems": false
26-
},
20+
"schema": { "unevaluatedItems": false },
2721
"tests": [
2822
{
2923
"description": "with no unevaluated items",
@@ -39,10 +33,7 @@
3933
},
4034
{
4135
"description": "unevaluatedItems as schema",
42-
"schema": {
43-
"type": "array",
44-
"unevaluatedItems": { "type": "string" }
45-
},
36+
"schema": { "unevaluatedItems": { "type": "string" } },
4637
"tests": [
4738
{
4839
"description": "with no unevaluated items",
@@ -64,7 +55,6 @@
6455
{
6556
"description": "unevaluatedItems with uniform items",
6657
"schema": {
67-
"type": "array",
6858
"items": { "type": "string" },
6959
"unevaluatedItems": false
7060
},
@@ -79,7 +69,6 @@
7969
{
8070
"description": "unevaluatedItems with tuple",
8171
"schema": {
82-
"type": "array",
8372
"items": [
8473
{ "type": "string" }
8574
],
@@ -101,7 +90,6 @@
10190
{
10291
"description": "unevaluatedItems with additionalItems",
10392
"schema": {
104-
"type": "array",
10593
"items": [
10694
{ "type": "string" }
10795
],
@@ -119,7 +107,6 @@
119107
{
120108
"description": "unevaluatedItems with nested tuple",
121109
"schema": {
122-
"type": "array",
123110
"items": [
124111
{ "type": "string" }
125112
],
@@ -176,7 +163,6 @@
176163
{
177164
"description": "unevaluatedItems with nested items and additionalItems",
178165
"schema": {
179-
"type": "array",
180166
"allOf": [
181167
{
182168
"items": [
@@ -203,16 +189,13 @@
203189
{
204190
"description": "unevaluatedItems with nested unevaluatedItems",
205191
"schema": {
206-
"type": "array",
207192
"allOf": [
208193
{
209194
"items": [
210195
{ "type": "string" }
211196
]
212197
},
213-
{
214-
"unevaluatedItems": true
215-
}
198+
{ "unevaluatedItems": true }
216199
],
217200
"unevaluatedItems": false
218201
},
@@ -232,7 +215,6 @@
232215
{
233216
"description": "unevaluatedItems with anyOf",
234217
"schema": {
235-
"type": "array",
236218
"items": [
237219
{ "const": "foo" }
238220
],
@@ -279,7 +261,6 @@
279261
{
280262
"description": "unevaluatedItems with oneOf",
281263
"schema": {
282-
"type": "array",
283264
"items": [
284265
{ "const": "foo" }
285266
],
@@ -315,7 +296,6 @@
315296
{
316297
"description": "unevaluatedItems with not",
317298
"schema": {
318-
"type": "array",
319299
"items": [
320300
{ "const": "foo" }
321301
],
@@ -340,10 +320,7 @@
340320
{
341321
"description": "unevaluatedItems with if/then/else",
342322
"schema": {
343-
"type": "array",
344-
"items": [
345-
{ "const": "foo" }
346-
],
323+
"items": [ { "const": "foo" } ],
347324
"if": {
348325
"items": [
349326
true,
@@ -393,7 +370,6 @@
393370
{
394371
"description": "unevaluatedItems with boolean schemas",
395372
"schema": {
396-
"type": "array",
397373
"allOf": [true],
398374
"unevaluatedItems": false
399375
},
@@ -413,7 +389,6 @@
413389
{
414390
"description": "unevaluatedItems with $ref",
415391
"schema": {
416-
"type": "array",
417392
"$ref": "#/$defs/bar",
418393
"items": [
419394
{ "type": "string" }
@@ -448,9 +423,7 @@
448423
{
449424
"items": [ true ]
450425
},
451-
{
452-
"unevaluatedItems": false
453-
}
426+
{ "unevaluatedItems": false }
454427
]
455428
},
456429
"tests": [
@@ -464,14 +437,10 @@
464437
{
465438
"description": "item is evaluated in an uncle schema to unevaluatedItems",
466439
"schema": {
467-
"type": "object",
468440
"properties": {
469441
"foo": {
470-
"type": "array",
471442
"items": [
472-
{
473-
"type": "string"
474-
}
443+
{ "type": "string" }
475444
],
476445
"unevaluatedItems": false
477446
}
@@ -482,9 +451,7 @@
482451
"foo": {
483452
"items": [
484453
true,
485-
{
486-
"type": "string"
487-
}
454+
{ "type": "string" }
488455
]
489456
}
490457
}

0 commit comments

Comments
 (0)