Skip to content

Commit f1b1ad0

Browse files
committed
Merge remote-tracking branch 'upstream/master' into issue-685
2 parents d9c0da8 + ff1ddcf commit f1b1ad0

35 files changed

+684
-36
lines changed

json/bin/jsonschema_suite

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ REMOTES = {
5050
u"refToInteger": {u"$ref": u"#/$defs/integer"},
5151
}
5252
},
53-
"folder/folderInteger.json": {u"type": u"integer"}
53+
"baseUriChange/folderInteger.json": {u"type": u"integer"},
54+
"baseUriChangeFolder/folderInteger.json": {u"type": u"integer"},
55+
"baseUriChangeFolderInSubschema/folderInteger.json": {u"type": u"integer"},
5456
}
5557
REMOTES_DIR = os.path.join(ROOT_DIR, "remotes")
5658

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "integer"
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "integer"
3+
}

json/tests/draft2019-09/const.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,90 @@
125125
}
126126
]
127127
},
128+
{
129+
"description": "const with [false] does not match [0]",
130+
"schema": {"const": [false]},
131+
"tests": [
132+
{
133+
"description": "[false] is valid",
134+
"data": [false],
135+
"valid": true
136+
},
137+
{
138+
"description": "[0] is invalid",
139+
"data": [0],
140+
"valid": false
141+
},
142+
{
143+
"description": "[0.0] is invalid",
144+
"data": [0.0],
145+
"valid": false
146+
}
147+
]
148+
},
149+
{
150+
"description": "const with [true] does not match [1]",
151+
"schema": {"const": [true]},
152+
"tests": [
153+
{
154+
"description": "[true] is valid",
155+
"data": [true],
156+
"valid": true
157+
},
158+
{
159+
"description": "[1] is invalid",
160+
"data": [1],
161+
"valid": false
162+
},
163+
{
164+
"description": "[1.0] is invalid",
165+
"data": [1.0],
166+
"valid": false
167+
}
168+
]
169+
},
170+
{
171+
"description": "const with {\"a\": false} does not match {\"a\": 0}",
172+
"schema": {"const": {"a": false}},
173+
"tests": [
174+
{
175+
"description": "{\"a\": false} is valid",
176+
"data": {"a": false},
177+
"valid": true
178+
},
179+
{
180+
"description": "{\"a\": 0} is invalid",
181+
"data": {"a": 0},
182+
"valid": false
183+
},
184+
{
185+
"description": "{\"a\": 0.0} is invalid",
186+
"data": {"a": 0.0},
187+
"valid": false
188+
}
189+
]
190+
},
191+
{
192+
"description": "const with {\"a\": true} does not match {\"a\": 1}",
193+
"schema": {"const": {"a": true}},
194+
"tests": [
195+
{
196+
"description": "{\"a\": true} is valid",
197+
"data": {"a": true},
198+
"valid": true
199+
},
200+
{
201+
"description": "{\"a\": 1} is invalid",
202+
"data": {"a": 1},
203+
"valid": false
204+
},
205+
{
206+
"description": "{\"a\": 1.0} is invalid",
207+
"data": {"a": 1.0},
208+
"valid": false
209+
}
210+
]
211+
},
128212
{
129213
"description": "const with 0 does not match other zero-like types",
130214
"schema": {"const": 0},

json/tests/draft2019-09/optional/format/date-time.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@
4747
"description": "only RFC3339 not all of ISO 8601 are valid",
4848
"data": "2013-350T01:01:01",
4949
"valid": false
50+
},
51+
{
52+
"description": "invalid non-padded month dates",
53+
"data": "1963-6-19T08:30:06.283185Z",
54+
"valid": false
55+
},
56+
{
57+
"description": "invalid non-padded day dates",
58+
"data": "1963-06-1T08:30:06.283185Z",
59+
"valid": false
5060
}
5161
]
5262
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
"description": "only RFC3339 not all of ISO 8601 are valid",
1818
"data": "2013-350",
1919
"valid": false
20+
},
21+
{
22+
"description": "invalidates non-padded month dates",
23+
"data": "1998-1-20",
24+
"valid": false
25+
},
26+
{
27+
"description": "invalidates non-padded day dates",
28+
"data": "1998-01-1",
29+
"valid": false
2030
}
2131
]
2232
}

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,41 @@
112112
"description": "ipv4 segment must have 4 octets",
113113
"data": "1:2:3:4:1.2.3",
114114
"valid": false
115+
},
116+
{
117+
"description": "leading whitespace is invalid",
118+
"data": " ::1",
119+
"valid": false
120+
},
121+
{
122+
"description": "trailing whitespace is invalid",
123+
"data": "::1 ",
124+
"valid": false
125+
},
126+
{
127+
"description": "netmask is not a part of ipv6 address",
128+
"data": "fe80::/64",
129+
"valid": false
130+
},
131+
{
132+
"description": "zone id is not a part of ipv6 address",
133+
"data": "fe80::a%eth1",
134+
"valid": false
135+
},
136+
{
137+
"description": "a long valid ipv6",
138+
"data": "1000:1000:1000:1000:1000:1000:255.255.255.255",
139+
"valid": true
140+
},
141+
{
142+
"description": "a long invalid ipv6, below length limit, first",
143+
"data": "100:100:100:100:100:100:255.255.255.255.255",
144+
"valid": false
145+
},
146+
{
147+
"description": "a long invalid ipv6, below length limit, second",
148+
"data": "100:100:100:100:100:100:100:255.255.255.255",
149+
"valid": false
115150
}
116151
]
117152
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@
9797
"description": "an invalid URI with spaces and missing scheme",
9898
"data": ":// should fail",
9999
"valid": false
100+
},
101+
{
102+
"description": "an invalid URI with comma in scheme",
103+
"data": "bar,baz:foo",
104+
"valid": false
100105
}
101106
]
102107
}

json/tests/draft2019-09/refRemote.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"schema": {
5555
"$id": "http://localhost:1234/",
5656
"items": {
57-
"$id": "folder/",
57+
"$id": "baseUriChange/",
5858
"items": {"$ref": "folderInteger.json"}
5959
}
6060
},
@@ -76,10 +76,10 @@
7676
"schema": {
7777
"$id": "http://localhost:1234/scope_change_defs1.json",
7878
"type" : "object",
79-
"properties": {"list": {"$ref": "folder/"}},
79+
"properties": {"list": {"$ref": "baseUriChangeFolder/"}},
8080
"$defs": {
8181
"baz": {
82-
"$id": "folder/",
82+
"$id": "baseUriChangeFolder/",
8383
"type": "array",
8484
"items": {"$ref": "folderInteger.json"}
8585
}
@@ -103,10 +103,10 @@
103103
"schema": {
104104
"$id": "http://localhost:1234/scope_change_defs2.json",
105105
"type" : "object",
106-
"properties": {"list": {"$ref": "folder/#/$defs/bar"}},
106+
"properties": {"list": {"$ref": "baseUriChangeFolderInSubschema/#/$defs/bar"}},
107107
"$defs": {
108108
"baz": {
109-
"$id": "folder/",
109+
"$id": "baseUriChangeFolderInSubschema/",
110110
"$defs": {
111111
"bar": {
112112
"type": "array",

json/tests/draft2019-09/uniqueItems.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,16 @@
113113
"description": "objects are non-unique despite key order",
114114
"data": [{"a": 1, "b": 2}, {"b": 2, "a": 1}],
115115
"valid": false
116+
},
117+
{
118+
"description": "{\"a\": false} and {\"a\": 0} are unique",
119+
"data": [{"a": false}, {"a": 0}],
120+
"valid": true
121+
},
122+
{
123+
"description": "{\"a\": true} and {\"a\": 1} are unique",
124+
"data": [{"a": true}, {"a": 1}],
125+
"valid": true
116126
}
117127
]
118128
},

json/tests/draft3/optional/format/date-time.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@
2222
"description": "only RFC3339 not all of ISO 8601 are valid",
2323
"data": "2013-350T01:01:01",
2424
"valid": false
25+
},
26+
{
27+
"description": "invalid non-padded month dates",
28+
"data": "1963-6-19T08:30:06.283185Z",
29+
"valid": false
30+
},
31+
{
32+
"description": "invalid non-padded day dates",
33+
"data": "1963-06-1T08:30:06.283185Z",
34+
"valid": false
2535
}
2636
]
2737
}

json/tests/draft3/optional/format/date.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@
1212
"description": "an invalid date string",
1313
"data": "06/19/1963",
1414
"valid": false
15+
},
16+
{
17+
"description": "only RFC3339 not all of ISO 8601 are valid",
18+
"data": "2013-350",
19+
"valid": false
20+
},
21+
{
22+
"description": "invalidates non-padded month dates",
23+
"data": "1998-1-20",
24+
"valid": false
25+
},
26+
{
27+
"description": "invalidates non-padded day dates",
28+
"data": "1998-01-1",
29+
"valid": false
1530
}
1631
]
1732
}

json/tests/draft3/refRemote.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"schema": {
5555
"id": "http://localhost:1234/",
5656
"items": {
57-
"id": "folder/",
57+
"id": "baseUriChange/",
5858
"items": {"$ref": "folderInteger.json"}
5959
}
6060
},

json/tests/draft3/uniqueItems.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@
9393
"description": "non-unique heterogeneous types are invalid",
9494
"data": [{}, [1], true, null, {}, 1],
9595
"valid": false
96+
},
97+
{
98+
"description": "{\"a\": false} and {\"a\": 0} are unique",
99+
"data": [{"a": false}, {"a": 0}],
100+
"valid": true
101+
},
102+
{
103+
"description": "{\"a\": true} and {\"a\": 1} are unique",
104+
"data": [{"a": true}, {"a": 1}],
105+
"valid": true
96106
}
97107
]
98108
},

json/tests/draft4/optional/format/date-time.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@
4747
"description": "only RFC3339 not all of ISO 8601 are valid",
4848
"data": "2013-350T01:01:01",
4949
"valid": false
50+
},
51+
{
52+
"description": "invalid non-padded month dates",
53+
"data": "1963-6-19T08:30:06.283185Z",
54+
"valid": false
55+
},
56+
{
57+
"description": "invalid non-padded day dates",
58+
"data": "1963-06-1T08:30:06.283185Z",
59+
"valid": false
5060
}
5161
]
5262
}

json/tests/draft4/optional/format/ipv6.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,41 @@
112112
"description": "ipv4 segment must have 4 octets",
113113
"data": "1:2:3:4:1.2.3",
114114
"valid": false
115+
},
116+
{
117+
"description": "leading whitespace is invalid",
118+
"data": " ::1",
119+
"valid": false
120+
},
121+
{
122+
"description": "trailing whitespace is invalid",
123+
"data": "::1 ",
124+
"valid": false
125+
},
126+
{
127+
"description": "netmask is not a part of ipv6 address",
128+
"data": "fe80::/64",
129+
"valid": false
130+
},
131+
{
132+
"description": "zone id is not a part of ipv6 address",
133+
"data": "fe80::a%eth1",
134+
"valid": false
135+
},
136+
{
137+
"description": "a long valid ipv6",
138+
"data": "1000:1000:1000:1000:1000:1000:255.255.255.255",
139+
"valid": true
140+
},
141+
{
142+
"description": "a long invalid ipv6, below length limit, first",
143+
"data": "100:100:100:100:100:100:255.255.255.255.255",
144+
"valid": false
145+
},
146+
{
147+
"description": "a long invalid ipv6, below length limit, second",
148+
"data": "100:100:100:100:100:100:100:255.255.255.255",
149+
"valid": false
115150
}
116151
]
117152
}

json/tests/draft4/optional/format/uri.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@
9797
"description": "an invalid URI with spaces and missing scheme",
9898
"data": ":// should fail",
9999
"valid": false
100+
},
101+
{
102+
"description": "an invalid URI with comma in scheme",
103+
"data": "bar,baz:foo",
104+
"valid": false
100105
}
101106
]
102107
}

0 commit comments

Comments
 (0)