Skip to content

Commit 72d5a27

Browse files
committed
Squashed 'json/' changes from 57001d26b..fc05651cc
fc05651cc Merge pull request #409 from Stranger6667/dd/add-jsonschema-rs 5f1575a93 Add Rust `jsonschema` crate 2bf95beec Merge pull request #407 from fisxoj/master 9ae956b21 Add common lisp implementation to the list d4ffd569b Merge pull request #401 from json-schema-org/ether/format-uuid 2d6c45711 tests for the "uuid" format 08f6cdaff Merge pull request #400 from json-schema-org/ether/more-format-ipv6 d3064eb3a some more tests for the "ipv6" format 1f34d3321 Merge pull request #399 from json-schema-org/ether/more-format-idn-email 22adda78c also test the "email" inputs against "idn-email" 25598a3b4 Merge pull request #392 from rjmill/rjmill/test-prop-named-ref-containing-a-ref 8dfa8adc9 Merge pull request #380 from ChALkeR/fix-ecmascript-regex d595dbf9d backport $ref cases, changing "$defs" to "definitions" ca8319c9e Fix \W test description 452b5f8f4 Test property named $ref, containing an actual $ref a01ae5404 Fix ECMA 262 regex whitespace tests. git-subtree-dir: json git-subtree-split: fc05651cce3889975f8dbcca38c203d6a396694b
1 parent ba8f9ae commit 72d5a27

File tree

19 files changed

+836
-20
lines changed

19 files changed

+836
-20
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ This suite is being used by:
8585

8686
* [jsck](https://github.com/pandastrike/jsck)
8787

88+
### Common Lisp
89+
90+
* [json-schema](https://github.com/fisxoj/json-schema)
91+
8892
### C++
8993

9094
* [Modern C++ JSON schema validator](https://github.com/pboettch/json-schema-validator)
@@ -179,6 +183,7 @@ which also welcomes your contributions!
179183

180184
### Rust
181185

186+
* [jsonschema](https://github.com/Stranger6667/jsonschema-rs)
182187
* [valico](https://github.com/rustless/valico)
183188

184189
### Swift

tests/draft2019-09/format.json

+36
Original file line numberDiff line numberDiff line change
@@ -610,5 +610,41 @@
610610
"valid": true
611611
}
612612
]
613+
},
614+
{
615+
"description": "validation of UUIDs",
616+
"schema": { "format": "uuid" },
617+
"tests": [
618+
{
619+
"description": "ignores integers",
620+
"data": 12,
621+
"valid": true
622+
},
623+
{
624+
"description": "ignores floats",
625+
"data": 13.7,
626+
"valid": true
627+
},
628+
{
629+
"description": "ignores objects",
630+
"data": {},
631+
"valid": true
632+
},
633+
{
634+
"description": "ignores arrays",
635+
"data": [],
636+
"valid": true
637+
},
638+
{
639+
"description": "ignores booleans",
640+
"data": false,
641+
"valid": true
642+
},
643+
{
644+
"description": "ignores null",
645+
"data": null,
646+
"valid": true
647+
}
648+
]
613649
}
614650
]

tests/draft2019-09/optional/ecmascript-regex.json

+95-5
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
]
155155
},
156156
{
157-
"description": "ECMA 262 \\w matches everything but ascii letters",
157+
"description": "ECMA 262 \\W matches everything but ascii letters",
158158
"schema": {
159159
"type": "string",
160160
"pattern": "^\\W$"
@@ -173,7 +173,7 @@
173173
]
174174
},
175175
{
176-
"description": "ECMA 262 \\s matches ascii whitespace only",
176+
"description": "ECMA 262 \\s matches whitespace",
177177
"schema": {
178178
"type": "string",
179179
"pattern": "^\\s$"
@@ -185,14 +185,59 @@
185185
"valid": true
186186
},
187187
{
188-
"description": "latin-1 non-breaking-space does not match (unlike e.g. Python)",
188+
"description": "Character tabulation matches",
189+
"data": "\t",
190+
"valid": true
191+
},
192+
{
193+
"description": "Line tabulation matches",
194+
"data": "\u000b",
195+
"valid": true
196+
},
197+
{
198+
"description": "Form feed matches",
199+
"data": "\u000c",
200+
"valid": true
201+
},
202+
{
203+
"description": "latin-1 non-breaking-space matches",
189204
"data": "\u00a0",
205+
"valid": true
206+
},
207+
{
208+
"description": "zero-width whitespace matches",
209+
"data": "\ufeff",
210+
"valid": true
211+
},
212+
{
213+
"description": "line feed matches (line terminator)",
214+
"data": "\u000a",
215+
"valid": true
216+
},
217+
{
218+
"description": "paragraph separator matches (line terminator)",
219+
"data": "\u2029",
220+
"valid": true
221+
},
222+
{
223+
"description": "EM SPACE matches (Space_Separator)",
224+
"data": "\u2003",
225+
"valid": true
226+
},
227+
{
228+
"description": "Non-whitespace control does not match",
229+
"data": "\u0001",
230+
"valid": false
231+
},
232+
{
233+
"description": "Non-whitespace does not match",
234+
"data": "\u2013",
190235
"valid": false
191236
}
192237
]
193238
},
194239
{
195-
"description": "ECMA 262 \\S matches everything but ascii whitespace",
240+
"description": "ECMA 262 \\S matches everything but whitespace",
196241
"schema": {
197242
"type": "string",
198243
"pattern": "^\\S$"
@@ -204,8 +249,53 @@
204249
"valid": false
205250
},
206251
{
207-
"description": "latin-1 non-breaking-space matches (unlike e.g. Python)",
252+
"description": "Character tabulation does not match",
253+
"data": "\t",
254+
"valid": false
255+
},
256+
{
257+
"description": "Line tabulation does not match",
258+
"data": "\u000b",
259+
"valid": false
260+
},
261+
{
262+
"description": "Form feed does not match",
263+
"data": "\u000c",
264+
"valid": false
265+
},
266+
{
267+
"description": "latin-1 non-breaking-space does not match",
208268
"data": "\u00a0",
269+
"valid": false
270+
},
271+
{
272+
"description": "zero-width whitespace does not match",
273+
"data": "\ufeff",
274+
"valid": false
275+
},
276+
{
277+
"description": "line feed does not match (line terminator)",
278+
"data": "\u000a",
279+
"valid": false
280+
},
281+
{
282+
"description": "paragraph separator does not match (line terminator)",
283+
"data": "\u2029",
284+
"valid": false
285+
},
286+
{
287+
"description": "EM SPACE does not match (Space_Separator)",
288+
"data": "\u2003",
289+
"valid": false
290+
},
291+
{
292+
"description": "Non-whitespace control matches",
293+
"data": "\u0001",
294+
"valid": true
295+
},
296+
{
297+
"description": "Non-whitespace matches",
298+
"data": "\u2013",
209299
"valid": true
210300
}
211301
]

tests/draft2019-09/optional/format/idn-email.json

+10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@
1212
"description": "an invalid idn e-mail address",
1313
"data": "2962",
1414
"valid": false
15+
},
16+
{
17+
"description": "a valid e-mail address",
18+
"data": "[email protected]",
19+
"valid": true
20+
},
21+
{
22+
"description": "an invalid e-mail address",
23+
"data": "2962",
24+
"valid": false
1525
}
1626
]
1727
}

tests/draft2019-09/optional/format/ipv6.json

+40
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,46 @@
2222
"description": "an IPv6 address containing illegal characters",
2323
"data": "::laptop",
2424
"valid": false
25+
},
26+
{
27+
"description": "no digits is valid",
28+
"data": "::",
29+
"valid": true
30+
},
31+
{
32+
"description": "leading colons is valid",
33+
"data": "::42:ff:1",
34+
"valid": true
35+
},
36+
{
37+
"description": "trailing colons is valid",
38+
"data": "d6::",
39+
"valid": true
40+
},
41+
{
42+
"description": "two sets of double colons is invalid",
43+
"data": "1::d6::42",
44+
"valid": false
45+
},
46+
{
47+
"description": "mixed format with the ipv4 section as decimal octets",
48+
"data": "1::d6:192.168.0.1",
49+
"valid": true
50+
},
51+
{
52+
"description": "mixed format with double colons between the sections",
53+
"data": "1:2::192.168.0.1",
54+
"valid": true
55+
},
56+
{
57+
"description": "mixed format with ipv4 section with octet out of range",
58+
"data": "1::2:192.168.256.1",
59+
"valid": false
60+
},
61+
{
62+
"description": "mixed format with ipv4 section with a hex octet",
63+
"data": "1::2:192.168.ff.1",
64+
"valid": false
2565
}
2666
]
2767
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
[
2+
{
3+
"description": "uuid format",
4+
"schema": {
5+
"format": "uuid"
6+
},
7+
"tests": [
8+
{
9+
"description": "all upper-case",
10+
"data": "2EB8AA08-AA98-11EA-B4AA-73B441D16380",
11+
"valid": true
12+
},
13+
{
14+
"description": "all lower-case",
15+
"data": "2eb8aa08-aa98-11ea-b4aa-73b441d16380",
16+
"valid": true
17+
},
18+
{
19+
"description": "mixed case",
20+
"data": "2eb8aa08-AA98-11ea-B4Aa-73B441D16380",
21+
"valid": true
22+
},
23+
{
24+
"description": "all zeroes is valid",
25+
"data": "00000000-0000-0000-0000-000000000000",
26+
"valid": true
27+
},
28+
{
29+
"description": "wrong length",
30+
"data": "2eb8aa08-aa98-11ea-b4aa-73b441d1638",
31+
"valid": false
32+
},
33+
{
34+
"description": "missing section",
35+
"data": "2eb8aa08-aa98-11ea-73b441d16380",
36+
"valid": false
37+
},
38+
{
39+
"description": "bad characters (not hex)",
40+
"data": "2eb8aa08-aa98-11ea-b4ga-73b441d16380",
41+
"valid": false
42+
},
43+
{
44+
"description": "no dashes",
45+
"data": "2eb8aa08aa9811eab4aa73b441d16380",
46+
"valid": false
47+
},
48+
{
49+
"description": "valid version 4",
50+
"data": "98d80576-482e-427f-8434-7f86890ab222",
51+
"valid": true
52+
},
53+
{
54+
"description": "valid version 5",
55+
"data": "99c17cbb-656f-564a-940f-1a4568f03487",
56+
"valid": true
57+
},
58+
{
59+
"description": "hypothetical version 6",
60+
"data": "99c17cbb-656f-664a-940f-1a4568f03487",
61+
"valid": true
62+
},
63+
{
64+
"description": "hypothetical version 15",
65+
"data": "99c17cbb-656f-f64a-940f-1a4568f03487",
66+
"valid": true
67+
}
68+
]
69+
}
70+
]

tests/draft2019-09/ref.json

+25
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,31 @@
211211
}
212212
]
213213
},
214+
{
215+
"description": "property named $ref, containing an actual $ref",
216+
"schema": {
217+
"properties": {
218+
"$ref": {"$ref": "#/$defs/is-string"}
219+
},
220+
"$defs": {
221+
"is-string": {
222+
"type": "string"
223+
}
224+
}
225+
},
226+
"tests": [
227+
{
228+
"description": "property named $ref valid",
229+
"data": {"$ref": "a"},
230+
"valid": true
231+
},
232+
{
233+
"description": "property named $ref invalid",
234+
"data": {"$ref": 2},
235+
"valid": false
236+
}
237+
]
238+
},
214239
{
215240
"description": "$ref to boolean schema true",
216241
"schema": {

0 commit comments

Comments
 (0)