Skip to content

Commit bc919bd

Browse files
authored
Merge pull request #755 from V02460/unevaluated-additional-properties
Test interaction between unevaluatedProperties and additionalProperties
2 parents 83e866b + 5273e0d commit bc919bd

File tree

1 file changed

+26
-36
lines changed

1 file changed

+26
-36
lines changed

tests/draft2020-12/unevaluatedProperties.json

+26-36
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"description": "unevaluatedProperties true",
44
"schema": {
55
"$schema": "https://json-schema.org/draft/2020-12/schema",
6-
"type": "object",
76
"unevaluatedProperties": true
87
},
98
"tests": [
@@ -25,7 +24,6 @@
2524
"description": "unevaluatedProperties schema",
2625
"schema": {
2726
"$schema": "https://json-schema.org/draft/2020-12/schema",
28-
"type": "object",
2927
"unevaluatedProperties": {
3028
"type": "string",
3129
"minLength": 3
@@ -57,7 +55,6 @@
5755
"description": "unevaluatedProperties false",
5856
"schema": {
5957
"$schema": "https://json-schema.org/draft/2020-12/schema",
60-
"type": "object",
6158
"unevaluatedProperties": false
6259
},
6360
"tests": [
@@ -79,7 +76,6 @@
7976
"description": "unevaluatedProperties with adjacent properties",
8077
"schema": {
8178
"$schema": "https://json-schema.org/draft/2020-12/schema",
82-
"type": "object",
8379
"properties": {
8480
"foo": { "type": "string" }
8581
},
@@ -107,7 +103,6 @@
107103
"description": "unevaluatedProperties with adjacent patternProperties",
108104
"schema": {
109105
"$schema": "https://json-schema.org/draft/2020-12/schema",
110-
"type": "object",
111106
"patternProperties": {
112107
"^foo": { "type": "string" }
113108
},
@@ -132,13 +127,9 @@
132127
]
133128
},
134129
{
135-
"description": "unevaluatedProperties with adjacent additionalProperties",
130+
"description": "unevaluatedProperties with adjacent bool additionalProperties",
136131
"schema": {
137132
"$schema": "https://json-schema.org/draft/2020-12/schema",
138-
"type": "object",
139-
"properties": {
140-
"foo": { "type": "string" }
141-
},
142133
"additionalProperties": true,
143134
"unevaluatedProperties": false
144135
},
@@ -160,11 +151,35 @@
160151
}
161152
]
162153
},
154+
{
155+
"description": "unevaluatedProperties with adjacent non-bool additionalProperties",
156+
"schema": {
157+
"$schema": "https://json-schema.org/draft/2020-12/schema",
158+
"additionalProperties": { "type": "string" },
159+
"unevaluatedProperties": false
160+
},
161+
"tests": [
162+
{
163+
"description": "with only valid additional properties",
164+
"data": {
165+
"foo": "foo"
166+
},
167+
"valid": true
168+
},
169+
{
170+
"description": "with invalid additional properties",
171+
"data": {
172+
"foo": "foo",
173+
"bar": 1
174+
},
175+
"valid": false
176+
}
177+
]
178+
},
163179
{
164180
"description": "unevaluatedProperties with nested properties",
165181
"schema": {
166182
"$schema": "https://json-schema.org/draft/2020-12/schema",
167-
"type": "object",
168183
"properties": {
169184
"foo": { "type": "string" }
170185
},
@@ -201,7 +216,6 @@
201216
"description": "unevaluatedProperties with nested patternProperties",
202217
"schema": {
203218
"$schema": "https://json-schema.org/draft/2020-12/schema",
204-
"type": "object",
205219
"properties": {
206220
"foo": { "type": "string" }
207221
},
@@ -238,7 +252,6 @@
238252
"description": "unevaluatedProperties with nested additionalProperties",
239253
"schema": {
240254
"$schema": "https://json-schema.org/draft/2020-12/schema",
241-
"type": "object",
242255
"properties": {
243256
"foo": { "type": "string" }
244257
},
@@ -271,7 +284,6 @@
271284
"description": "unevaluatedProperties with nested unevaluatedProperties",
272285
"schema": {
273286
"$schema": "https://json-schema.org/draft/2020-12/schema",
274-
"type": "object",
275287
"properties": {
276288
"foo": { "type": "string" }
277289
},
@@ -307,7 +319,6 @@
307319
"description": "unevaluatedProperties with anyOf",
308320
"schema": {
309321
"$schema": "https://json-schema.org/draft/2020-12/schema",
310-
"type": "object",
311322
"properties": {
312323
"foo": { "type": "string" }
313324
},
@@ -376,7 +387,6 @@
376387
"description": "unevaluatedProperties with oneOf",
377388
"schema": {
378389
"$schema": "https://json-schema.org/draft/2020-12/schema",
379-
"type": "object",
380390
"properties": {
381391
"foo": { "type": "string" }
382392
},
@@ -420,7 +430,6 @@
420430
"description": "unevaluatedProperties with not",
421431
"schema": {
422432
"$schema": "https://json-schema.org/draft/2020-12/schema",
423-
"type": "object",
424433
"properties": {
425434
"foo": { "type": "string" }
426435
},
@@ -449,7 +458,6 @@
449458
"description": "unevaluatedProperties with if/then/else",
450459
"schema": {
451460
"$schema": "https://json-schema.org/draft/2020-12/schema",
452-
"type": "object",
453461
"if": {
454462
"properties": {
455463
"foo": { "const": "then" }
@@ -509,7 +517,6 @@
509517
"description": "unevaluatedProperties with if/then/else, then not defined",
510518
"schema": {
511519
"$schema": "https://json-schema.org/draft/2020-12/schema",
512-
"type": "object",
513520
"if": {
514521
"properties": {
515522
"foo": { "const": "then" }
@@ -563,7 +570,6 @@
563570
"description": "unevaluatedProperties with if/then/else, else not defined",
564571
"schema": {
565572
"$schema": "https://json-schema.org/draft/2020-12/schema",
566-
"type": "object",
567573
"if": {
568574
"properties": {
569575
"foo": { "const": "then" }
@@ -617,7 +623,6 @@
617623
"description": "unevaluatedProperties with dependentSchemas",
618624
"schema": {
619625
"$schema": "https://json-schema.org/draft/2020-12/schema",
620-
"type": "object",
621626
"properties": {
622627
"foo": { "type": "string" }
623628
},
@@ -653,7 +658,6 @@
653658
"description": "unevaluatedProperties with boolean schemas",
654659
"schema": {
655660
"$schema": "https://json-schema.org/draft/2020-12/schema",
656-
"type": "object",
657661
"properties": {
658662
"foo": { "type": "string" }
659663
},
@@ -681,7 +685,6 @@
681685
"description": "unevaluatedProperties with $ref",
682686
"schema": {
683687
"$schema": "https://json-schema.org/draft/2020-12/schema",
684-
"type": "object",
685688
"$ref": "#/$defs/bar",
686689
"properties": {
687690
"foo": { "type": "string" }
@@ -719,7 +722,6 @@
719722
"description": "unevaluatedProperties before $ref",
720723
"schema": {
721724
"$schema": "https://json-schema.org/draft/2020-12/schema",
722-
"type": "object",
723725
"unevaluatedProperties": false,
724726
"properties": {
725727
"foo": { "type": "string" }
@@ -773,7 +775,6 @@
773775

774776
"$comment": "unevaluatedProperties comes first so it's more likely to catch bugs with implementations that are sensitive to keyword ordering",
775777
"unevaluatedProperties": false,
776-
"type": "object",
777778
"properties": {
778779
"foo": { "type": "string" }
779780
},
@@ -862,7 +863,6 @@
862863
"description": "nested unevaluatedProperties, outer false, inner true, properties outside",
863864
"schema": {
864865
"$schema": "https://json-schema.org/draft/2020-12/schema",
865-
"type": "object",
866866
"properties": {
867867
"foo": { "type": "string" }
868868
},
@@ -895,7 +895,6 @@
895895
"description": "nested unevaluatedProperties, outer false, inner true, properties inside",
896896
"schema": {
897897
"$schema": "https://json-schema.org/draft/2020-12/schema",
898-
"type": "object",
899898
"allOf": [
900899
{
901900
"properties": {
@@ -928,7 +927,6 @@
928927
"description": "nested unevaluatedProperties, outer true, inner false, properties outside",
929928
"schema": {
930929
"$schema": "https://json-schema.org/draft/2020-12/schema",
931-
"type": "object",
932930
"properties": {
933931
"foo": { "type": "string" }
934932
},
@@ -961,7 +959,6 @@
961959
"description": "nested unevaluatedProperties, outer true, inner false, properties inside",
962960
"schema": {
963961
"$schema": "https://json-schema.org/draft/2020-12/schema",
964-
"type": "object",
965962
"allOf": [
966963
{
967964
"properties": {
@@ -994,7 +991,6 @@
994991
"description": "cousin unevaluatedProperties, true and false, true with properties",
995992
"schema": {
996993
"$schema": "https://json-schema.org/draft/2020-12/schema",
997-
"type": "object",
998994
"allOf": [
999995
{
1000996
"properties": {
@@ -1029,7 +1025,6 @@
10291025
"description": "cousin unevaluatedProperties, true and false, false with properties",
10301026
"schema": {
10311027
"$schema": "https://json-schema.org/draft/2020-12/schema",
1032-
"type": "object",
10331028
"allOf": [
10341029
{
10351030
"unevaluatedProperties": true
@@ -1065,10 +1060,8 @@
10651060
"comment": "see https://stackoverflow.com/questions/66936884/deeply-nested-unevaluatedproperties-and-their-expectations",
10661061
"schema": {
10671062
"$schema": "https://json-schema.org/draft/2020-12/schema",
1068-
"type": "object",
10691063
"properties": {
10701064
"foo": {
1071-
"type": "object",
10721065
"properties": {
10731066
"bar": {
10741067
"type": "string"
@@ -1117,7 +1110,6 @@
11171110
"description": "in-place applicator siblings, allOf has unevaluated",
11181111
"schema": {
11191112
"$schema": "https://json-schema.org/draft/2020-12/schema",
1120-
"type": "object",
11211113
"allOf": [
11221114
{
11231115
"properties": {
@@ -1163,7 +1155,6 @@
11631155
"description": "in-place applicator siblings, anyOf has unevaluated",
11641156
"schema": {
11651157
"$schema": "https://json-schema.org/draft/2020-12/schema",
1166-
"type": "object",
11671158
"allOf": [
11681159
{
11691160
"properties": {
@@ -1209,7 +1200,6 @@
12091200
"description": "unevaluatedProperties + single cyclic ref",
12101201
"schema": {
12111202
"$schema": "https://json-schema.org/draft/2020-12/schema",
1212-
"type": "object",
12131203
"properties": {
12141204
"x": { "$ref": "#" }
12151205
},

0 commit comments

Comments
 (0)