Skip to content

Commit 74dfd48

Browse files
committed
Squashed 'json/' changes from 217bf81b..544f7c3d
544f7c3d Merge pull request #712 from otto-ifak/main 9dad3ebe Add tests for enum with array of bool 589a0858 Merge pull request #706 from marksparkza/unevaluated-before-ref 64d5cab9 Merge pull request #710 from spacether/patch-1 418cdbd6 Removes idea folder e0a9e066 Updates all other tests to mention grapheme/graphemes 69136952 Update minLength.json 4a2c61e8 Test unevaluatedItems|Properties before $ref git-subtree-dir: json git-subtree-split: 544f7c3df93b69f84f587b345f2835c380e43226
1 parent 3e46f22 commit 74dfd48

26 files changed

+761
-14
lines changed

json/tests/draft-next/enum.json

+96
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,30 @@
168168
}
169169
]
170170
},
171+
{
172+
"description": "enum with [false] does not match [0]",
173+
"schema": {
174+
"$schema": "https://json-schema.org/draft/next/schema",
175+
"enum": [[false]]
176+
},
177+
"tests": [
178+
{
179+
"description": "[false] is valid",
180+
"data": [false],
181+
"valid": true
182+
},
183+
{
184+
"description": "[0] is invalid",
185+
"data": [0],
186+
"valid": false
187+
},
188+
{
189+
"description": "[0.0] is invalid",
190+
"data": [0.0],
191+
"valid": false
192+
}
193+
]
194+
},
171195
{
172196
"description": "enum with true does not match 1",
173197
"schema": {
@@ -192,6 +216,30 @@
192216
}
193217
]
194218
},
219+
{
220+
"description": "enum with [true] does not match [1]",
221+
"schema": {
222+
"$schema": "https://json-schema.org/draft/next/schema",
223+
"enum": [[true]]
224+
},
225+
"tests": [
226+
{
227+
"description": "[true] is valid",
228+
"data": [true],
229+
"valid": true
230+
},
231+
{
232+
"description": "[1] is invalid",
233+
"data": [1],
234+
"valid": false
235+
},
236+
{
237+
"description": "[1.0] is invalid",
238+
"data": [1.0],
239+
"valid": false
240+
}
241+
]
242+
},
195243
{
196244
"description": "enum with 0 does not match false",
197245
"schema": {
@@ -216,6 +264,30 @@
216264
}
217265
]
218266
},
267+
{
268+
"description": "enum with [0] does not match [false]",
269+
"schema": {
270+
"$schema": "https://json-schema.org/draft/next/schema",
271+
"enum": [[0]]
272+
},
273+
"tests": [
274+
{
275+
"description": "[false] is invalid",
276+
"data": [false],
277+
"valid": false
278+
},
279+
{
280+
"description": "[0] is valid",
281+
"data": [0],
282+
"valid": true
283+
},
284+
{
285+
"description": "[0.0] is valid",
286+
"data": [0.0],
287+
"valid": true
288+
}
289+
]
290+
},
219291
{
220292
"description": "enum with 1 does not match true",
221293
"schema": {
@@ -240,6 +312,30 @@
240312
}
241313
]
242314
},
315+
{
316+
"description": "enum with [1] does not match [true]",
317+
"schema": {
318+
"$schema": "https://json-schema.org/draft/next/schema",
319+
"enum": [[1]]
320+
},
321+
"tests": [
322+
{
323+
"description": "[true] is invalid",
324+
"data": [true],
325+
"valid": false
326+
},
327+
{
328+
"description": "[1] is valid",
329+
"data": [1],
330+
"valid": true
331+
},
332+
{
333+
"description": "[1.0] is valid",
334+
"data": [1.0],
335+
"valid": true
336+
}
337+
]
338+
},
243339
{
244340
"description": "nul characters in strings",
245341
"schema": {

json/tests/draft-next/maxLength.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"valid": true
2828
},
2929
{
30-
"description": "two supplementary Unicode code points is long enough",
30+
"description": "two graphemes is long enough",
3131
"data": "\uD83D\uDCA9\uD83D\uDCA9",
3232
"valid": true
3333
}

json/tests/draft-next/minLength.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"valid": true
2828
},
2929
{
30-
"description": "one supplementary Unicode code point is not long enough",
30+
"description": "one grapheme is not long enough",
3131
"data": "\uD83D\uDCA9",
3232
"valid": false
3333
}

json/tests/draft-next/unevaluatedItems.json

+31
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,37 @@
461461
}
462462
]
463463
},
464+
{
465+
"description": "unevaluatedItems before $ref",
466+
"schema": {
467+
"$schema": "https://json-schema.org/draft/next/schema",
468+
"unevaluatedItems": false,
469+
"prefixItems": [
470+
{ "type": "string" }
471+
],
472+
"$ref": "#/$defs/bar",
473+
"$defs": {
474+
"bar": {
475+
"prefixItems": [
476+
true,
477+
{ "type": "string" }
478+
]
479+
}
480+
}
481+
},
482+
"tests": [
483+
{
484+
"description": "with no unevaluated items",
485+
"data": ["foo", "bar"],
486+
"valid": true
487+
},
488+
{
489+
"description": "with unevaluated items",
490+
"data": ["foo", "bar", "baz"],
491+
"valid": false
492+
}
493+
]
494+
},
464495
{
465496
"description": "unevaluatedItems with $dynamicRef",
466497
"schema": {

json/tests/draft-next/unevaluatedProperties.json

+38
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,44 @@
715715
}
716716
]
717717
},
718+
{
719+
"description": "unevaluatedProperties before $ref",
720+
"schema": {
721+
"$schema": "https://json-schema.org/draft/next/schema",
722+
"type": "object",
723+
"unevaluatedProperties": false,
724+
"properties": {
725+
"foo": { "type": "string" }
726+
},
727+
"$ref": "#/$defs/bar",
728+
"$defs": {
729+
"bar": {
730+
"properties": {
731+
"bar": { "type": "string" }
732+
}
733+
}
734+
}
735+
},
736+
"tests": [
737+
{
738+
"description": "with no unevaluated properties",
739+
"data": {
740+
"foo": "foo",
741+
"bar": "bar"
742+
},
743+
"valid": true
744+
},
745+
{
746+
"description": "with unevaluated properties",
747+
"data": {
748+
"foo": "foo",
749+
"bar": "bar",
750+
"baz": "baz"
751+
},
752+
"valid": false
753+
}
754+
]
755+
},
718756
{
719757
"description": "unevaluatedProperties with $dynamicRef",
720758
"schema": {

json/tests/draft2019-09/enum.json

+96
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,30 @@
168168
}
169169
]
170170
},
171+
{
172+
"description": "enum with [false] does not match [0]",
173+
"schema": {
174+
"$schema": "https://json-schema.org/draft/2019-09/schema",
175+
"enum": [[false]]
176+
},
177+
"tests": [
178+
{
179+
"description": "[false] is valid",
180+
"data": [false],
181+
"valid": true
182+
},
183+
{
184+
"description": "[0] is invalid",
185+
"data": [0],
186+
"valid": false
187+
},
188+
{
189+
"description": "[0.0] is invalid",
190+
"data": [0.0],
191+
"valid": false
192+
}
193+
]
194+
},
171195
{
172196
"description": "enum with true does not match 1",
173197
"schema": {
@@ -192,6 +216,30 @@
192216
}
193217
]
194218
},
219+
{
220+
"description": "enum with [true] does not match [1]",
221+
"schema": {
222+
"$schema": "https://json-schema.org/draft/2019-09/schema",
223+
"enum": [[true]]
224+
},
225+
"tests": [
226+
{
227+
"description": "[true] is valid",
228+
"data": [true],
229+
"valid": true
230+
},
231+
{
232+
"description": "[1] is invalid",
233+
"data": [1],
234+
"valid": false
235+
},
236+
{
237+
"description": "[1.0] is invalid",
238+
"data": [1.0],
239+
"valid": false
240+
}
241+
]
242+
},
195243
{
196244
"description": "enum with 0 does not match false",
197245
"schema": {
@@ -216,6 +264,30 @@
216264
}
217265
]
218266
},
267+
{
268+
"description": "enum with [0] does not match [false]",
269+
"schema": {
270+
"$schema": "https://json-schema.org/draft/2019-09/schema",
271+
"enum": [[0]]
272+
},
273+
"tests": [
274+
{
275+
"description": "[false] is invalid",
276+
"data": [false],
277+
"valid": false
278+
},
279+
{
280+
"description": "[0] is valid",
281+
"data": [0],
282+
"valid": true
283+
},
284+
{
285+
"description": "[0.0] is valid",
286+
"data": [0.0],
287+
"valid": true
288+
}
289+
]
290+
},
219291
{
220292
"description": "enum with 1 does not match true",
221293
"schema": {
@@ -240,6 +312,30 @@
240312
}
241313
]
242314
},
315+
{
316+
"description": "enum with [1] does not match [true]",
317+
"schema": {
318+
"$schema": "https://json-schema.org/draft/2019-09/schema",
319+
"enum": [[1]]
320+
},
321+
"tests": [
322+
{
323+
"description": "[true] is invalid",
324+
"data": [true],
325+
"valid": false
326+
},
327+
{
328+
"description": "[1] is valid",
329+
"data": [1],
330+
"valid": true
331+
},
332+
{
333+
"description": "[1.0] is valid",
334+
"data": [1.0],
335+
"valid": true
336+
}
337+
]
338+
},
243339
{
244340
"description": "nul characters in strings",
245341
"schema": {

json/tests/draft2019-09/maxLength.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"valid": true
2828
},
2929
{
30-
"description": "two supplementary Unicode code points is long enough",
30+
"description": "two graphemes is long enough",
3131
"data": "\uD83D\uDCA9\uD83D\uDCA9",
3232
"valid": true
3333
}

json/tests/draft2019-09/minLength.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"valid": true
2828
},
2929
{
30-
"description": "one supplementary Unicode code point is not long enough",
30+
"description": "one grapheme is not long enough",
3131
"data": "\uD83D\uDCA9",
3232
"valid": false
3333
}

0 commit comments

Comments
 (0)