Skip to content

Commit 639c91f

Browse files
committed
Update test schemas
1 parent c98a334 commit 639c91f

File tree

2 files changed

+144
-38
lines changed

2 files changed

+144
-38
lines changed

tests/corpus-suite-schemas.json

Lines changed: 138 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"draft4/$ref prevents a sibling id from changing the base uri": {
44
"allOf": [
55
{
6-
"$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not ttp://localhost:1234/sibling_id/foo.json",
6+
"$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not http://localhost:1234/sibling_id/foo.json",
77
"$ref": "foo.json",
88
"id": "http://localhost:1234/sibling_id/"
99
}
@@ -12,11 +12,11 @@
1212
"base_foo": {
1313
"$comment": "this canonical uri is http://localhost:1234/sibling_id/base/foo.json",
1414
"id": "foo.json",
15-
"minimum": 5
15+
"type": "number"
1616
},
1717
"foo": {
1818
"id": "http://localhost:1234/sibling_id/foo.json",
19-
"minimum": 2
19+
"type": "string"
2020
}
2121
},
2222
"id": "http://localhost:1234/sibling_id/base/"
@@ -91,6 +91,20 @@
9191
],
9292
"type": "object"
9393
},
94+
"draft4/\\d in patternProperties matches [0-9], not unicode digits": {
95+
"additionalProperties": false,
96+
"patternProperties": {
97+
"^\\d+$": {}
98+
},
99+
"type": "object"
100+
},
101+
"draft4/\\w in patternProperties matches [A-Za-z0-9_], not unicode letters": {
102+
"additionalProperties": false,
103+
"patternProperties": {
104+
"\\wcole": {}
105+
},
106+
"type": "object"
107+
},
94108
"draft4/all integers are multiples of 0.5, if overflow is handled": {
95109
"multipleOf": 0.5,
96110
"type": "number"
@@ -182,6 +196,27 @@
182196
}
183197
}
184198
},
199+
"draft4/id must be resolved against nearest parent, not just immediate parent": {
200+
"allOf": [
201+
{
202+
"$ref": "http://example.com/b/d.json"
203+
}
204+
],
205+
"definitions": {
206+
"x": {
207+
"id": "http://example.com/b/c.json",
208+
"not": {
209+
"definitions": {
210+
"y": {
211+
"id": "d.json",
212+
"type": "number"
213+
}
214+
}
215+
}
216+
}
217+
},
218+
"id": "http://example.com/a.json"
219+
},
185220
"draft4/maximum validation (explicit false exclusivity)": {
186221
"exclusiveMaximum": false,
187222
"maximum": 3.0
@@ -233,14 +268,14 @@
233268
"draft4/unicode digits are more than 0 through 9": {
234269
"additionalProperties": false,
235270
"patternProperties": {
236-
"^\\d+$": {}
271+
"^\\p{digit}+$": {}
237272
},
238273
"type": "object"
239274
},
240275
"draft4/unicode semantics should be used for all patternProperties matching": {
241276
"additionalProperties": false,
242277
"patternProperties": {
243-
"\\wcole": {}
278+
"\\p{Letter}cole": {}
244279
},
245280
"type": "object"
246281
},
@@ -286,11 +321,32 @@
286321
}
287322
}
288323
},
324+
"draft7/$id must be resolved against nearest parent, not just immediate parent": {
325+
"$id": "http://example.com/a.json",
326+
"allOf": [
327+
{
328+
"$ref": "http://example.com/b/d.json"
329+
}
330+
],
331+
"definitions": {
332+
"x": {
333+
"$id": "http://example.com/b/c.json",
334+
"not": {
335+
"definitions": {
336+
"y": {
337+
"$id": "d.json",
338+
"type": "number"
339+
}
340+
}
341+
}
342+
}
343+
}
344+
},
289345
"draft7/$ref prevents a sibling $id from changing the base uri": {
290346
"$id": "http://localhost:1234/sibling_id/base/",
291347
"allOf": [
292348
{
293-
"$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not ttp://localhost:1234/sibling_id/foo.json",
349+
"$comment": "$ref resolves to http://localhost:1234/sibling_id/base/foo.json, not http://localhost:1234/sibling_id/foo.json",
294350
"$id": "http://localhost:1234/sibling_id/",
295351
"$ref": "foo.json"
296352
}
@@ -299,11 +355,11 @@
299355
"base_foo": {
300356
"$comment": "this canonical uri is http://localhost:1234/sibling_id/base/foo.json",
301357
"$id": "foo.json",
302-
"minimum": 5
358+
"type": "number"
303359
},
304360
"foo": {
305361
"$id": "http://localhost:1234/sibling_id/foo.json",
306-
"minimum": 2
362+
"type": "string"
307363
}
308364
}
309365
},
@@ -437,6 +493,26 @@
437493
],
438494
"type": "object"
439495
},
496+
"draft7/\\d in pattern matches [0-9], not unicode digits": {
497+
"pattern": "^\\d+$"
498+
},
499+
"draft7/\\d in patternProperties matches [0-9], not unicode digits": {
500+
"additionalProperties": false,
501+
"patternProperties": {
502+
"^\\d+$": true
503+
},
504+
"type": "object"
505+
},
506+
"draft7/\\w in patternProperties matches [A-Za-z0-9_], not unicode letters": {
507+
"additionalProperties": false,
508+
"patternProperties": {
509+
"\\wcole": true
510+
},
511+
"type": "object"
512+
},
513+
"draft7/\\w in patterns matches [A-Za-z0-9_], not unicode letters": {
514+
"pattern": "\\wcole"
515+
},
440516
"draft7/a schema given for items": {
441517
"items": {
442518
"type": "integer"
@@ -848,6 +924,12 @@
848924
"if": false
849925
}
850926
},
927+
"draft7/date format": {
928+
"format": "date"
929+
},
930+
"draft7/date-time format": {
931+
"format": "date-time"
932+
},
851933
"draft7/dependencies": {
852934
"dependencies": {
853935
"bar": [
@@ -884,6 +966,9 @@
884966
}
885967
}
886968
},
969+
"draft7/email format": {
970+
"format": "email"
971+
},
887972
"draft7/enum with 0 does not match false": {
888973
"enum": [
889974
0
@@ -1012,6 +1097,9 @@
10121097
null
10131098
]
10141099
},
1100+
"draft7/hostname format": {
1101+
"format": "hostname"
1102+
},
10151103
"draft7/id inside an enum is not a real identifier": {
10161104
"anyOf": [
10171105
{
@@ -1042,6 +1130,12 @@
10421130
}
10431131
}
10441132
},
1133+
"draft7/idn-email format": {
1134+
"format": "idn-email"
1135+
},
1136+
"draft7/idn-hostname format": {
1137+
"format": "idn-hostname"
1138+
},
10451139
"draft7/if and else without then": {
10461140
"else": {
10471141
"multipleOf": 2
@@ -1128,6 +1222,18 @@
11281222
}
11291223
}
11301224
},
1225+
"draft7/ipv4 format": {
1226+
"format": "ipv4"
1227+
},
1228+
"draft7/ipv6 format": {
1229+
"format": "ipv6"
1230+
},
1231+
"draft7/iri format": {
1232+
"format": "iri"
1233+
},
1234+
"draft7/iri-reference format": {
1235+
"format": "iri-reference"
1236+
},
11311237
"draft7/items + contains": {
11321238
"contains": {
11331239
"multipleOf": 3
@@ -1193,6 +1299,9 @@
11931299
false
11941300
]
11951301
},
1302+
"draft7/json-pointer format": {
1303+
"format": "json-pointer"
1304+
},
11961305
"draft7/maxItems validation": {
11971306
"maxItems": 2
11981307
},
@@ -1674,6 +1783,9 @@
16741783
}
16751784
}
16761785
},
1786+
"draft7/regex format": {
1787+
"format": "regex"
1788+
},
16771789
"draft7/regexes are not anchored by default and are case sensitive": {
16781790
"patternProperties": {
16791791
"X_": {
@@ -1731,6 +1843,9 @@
17311843
}
17321844
}
17331845
},
1846+
"draft7/relative-json-pointer format": {
1847+
"format": "relative-json-pointer"
1848+
},
17341849
"draft7/remote ref": {
17351850
"$ref": "http://localhost:1234/integer.json"
17361851
},
@@ -1812,6 +1927,9 @@
18121927
},
18131928
"type": "object"
18141929
},
1930+
"draft7/time format": {
1931+
"format": "time"
1932+
},
18151933
"draft7/type as array with one item": {
18161934
"type": [
18171935
"string"
@@ -1840,17 +1958,17 @@
18401958
"draft7/unicode digits are more than 0 through 9": {
18411959
"additionalProperties": false,
18421960
"patternProperties": {
1843-
"^\\d+$": true
1961+
"^\\p{digit}+$": true
18441962
},
18451963
"type": "object"
18461964
},
18471965
"draft7/unicode semantics should be used for all pattern matching": {
1848-
"pattern": "\\wcole"
1966+
"pattern": "\\p{Letter}cole"
18491967
},
18501968
"draft7/unicode semantics should be used for all patternProperties matching": {
18511969
"additionalProperties": false,
18521970
"patternProperties": {
1853-
"\\wcole": true
1971+
"\\p{Letter}cole": true
18541972
},
18551973
"type": "object"
18561974
},
@@ -1906,6 +2024,15 @@
19062024
],
19072025
"uniqueItems": false
19082026
},
2027+
"draft7/uri format": {
2028+
"format": "uri"
2029+
},
2030+
"draft7/uri-reference format": {
2031+
"format": "uri-reference"
2032+
},
2033+
"draft7/uri-template format": {
2034+
"format": "uri-template"
2035+
},
19092036
"draft7/validate against correct branch, then vs else": {
19102037
"else": {
19112038
"multipleOf": 2
@@ -1920,12 +2047,6 @@
19202047
"draft7/validate definition against metaschema": {
19212048
"$ref": "http://json-schema.org/draft-07/schema#"
19222049
},
1923-
"draft7/validation of IDN e-mail addresses": {
1924-
"format": "idn-email"
1925-
},
1926-
"draft7/validation of IDN hostnames": {
1927-
"format": "idn-hostname"
1928-
},
19292050
"draft7/validation of IP addresses": {
19302051
"format": "ipv4"
19312052
},
@@ -1935,15 +2056,9 @@
19352056
"draft7/validation of IRI References": {
19362057
"format": "iri-reference"
19372058
},
1938-
"draft7/validation of IRI references": {
1939-
"format": "iri-reference"
1940-
},
19412059
"draft7/validation of IRIs": {
19422060
"format": "iri"
19432061
},
1944-
"draft7/validation of JSON pointers": {
1945-
"format": "json-pointer"
1946-
},
19472062
"draft7/validation of JSON-pointers (JSON String Representation)": {
19482063
"format": "json-pointer"
19492064
},
@@ -1953,12 +2068,6 @@
19532068
"draft7/validation of URI References": {
19542069
"format": "uri-reference"
19552070
},
1956-
"draft7/validation of URI references": {
1957-
"format": "uri-reference"
1958-
},
1959-
"draft7/validation of URI templates": {
1960-
"format": "uri-template"
1961-
},
19622071
"draft7/validation of URIs": {
19632072
"format": "uri"
19642073
},
@@ -1984,21 +2093,12 @@
19842093
"draft7/validation of host names": {
19852094
"format": "hostname"
19862095
},
1987-
"draft7/validation of hostnames": {
1988-
"format": "hostname"
1989-
},
19902096
"draft7/validation of internationalized host names": {
19912097
"format": "idn-hostname"
19922098
},
1993-
"draft7/validation of regexes": {
1994-
"format": "regex"
1995-
},
19962099
"draft7/validation of regular expressions": {
19972100
"format": "regex"
19982101
},
1999-
"draft7/validation of relative JSON pointers": {
2000-
"format": "relative-json-pointer"
2001-
},
20022102
"draft7/validation of string-encoded content based on media type": {
20032103
"contentMediaType": "application/json"
20042104
},

tests/test_from_schema.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ def test_invalid_regex_emit_warning(schema):
110110
}
111111
UNSUPPORTED_SCHEMAS = {
112112
# Technically valid, but using regex patterns not supported by Python
113+
"draft4/unicode digits are more than 0 through 9",
114+
"draft4/unicode semantics should be used for all patternProperties matching",
115+
"draft7/unicode digits are more than 0 through 9",
116+
"draft7/unicode semantics should be used for all pattern matching",
117+
"draft7/unicode semantics should be used for all patternProperties matching",
113118
"draft7/ECMA 262 regex escapes control codes with \\c and lower letter",
114119
"draft7/ECMA 262 regex escapes control codes with \\c and upper letter",
115120
"JSON schema for nodemon.json configuration files.",
@@ -178,6 +183,7 @@ def test_invalid_regex_emit_warning(schema):
178183
"JSON API document",
179184
"Prometheus configuration file",
180185
"JSON schema for electron-build configuration file.",
186+
"Pyrseas database schema versioning for Postgres databases, v0.8",
181187
# oneOf on property names means only objects are valid, but it's a very
182188
# filter-heavy way to express that. TODO: canonicalise oneOf to anyOf.
183189
"draft7/oneOf complex types",

0 commit comments

Comments
 (0)