Skip to content

Commit 5195dd8

Browse files
committed
Squashed 'json/' changes from 689d2f28..0f344a69
0f344a69 Merge pull request #313 from leadpony/issue309 46c44747 Replace the control escape \\a with \\t 1ffe03e5 Merge pull request #312 from gregsdennis/master de004798 better descripttions eea7f249 arrays have characters too 7c02d06d added unevaluatedProperties test file; resolves #310 1899a5aa Merge pull request #308 from aznan2/master 4a5010b3 Update the version list. 37569b13 issue #307 - made test compatible with draft4 e3087307 issue #307 - removed issue reference from description e13d3275 issue #307 - removed pound sign from description a3b9f723 issue #307 - test that oneOf handles missing optional property git-subtree-dir: json git-subtree-split: 0f344a698f6657441adf4ebf4ceeacd596683422
1 parent a40ce64 commit 5195dd8

File tree

10 files changed

+227
-20
lines changed

10 files changed

+227
-20
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,15 @@ they should be valid or invalid.
5252
Coverage
5353
--------
5454

55-
Drafts 03, 04, 06, and 07 should have full coverage, with drafts 06 and 07
56-
being considered current and actively supported. Bug fixes will be made as
57-
needed for draft-04 as it is still the most widely used, while draft-03
58-
is long since deprecated.
55+
Drafts 07, 06, 04 and 03 should have full coverage, with drafts 06 and
56+
07 being considered current and actively supported.
57+
58+
Draft 2019-09 support is under development. Contributions are very
59+
welcome, especially from implementers as they add support to their own
60+
implementations.
61+
62+
Bug fixes will be made as needed for draft-04 as it is still the most
63+
widely used, while draft-03 is long since deprecated.
5964

6065
If you see anything missing from the current supported drafts, or incorrect
6166
on any draft still accepting bug fixes, please file an issue or submit a PR.

tests/draft2019-09/oneOf.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,5 +202,47 @@
202202
"valid": false
203203
}
204204
]
205+
},
206+
{
207+
"description": "oneOf with missing optional property",
208+
"schema": {
209+
"oneOf": [
210+
{
211+
"properties": {
212+
"bar": true,
213+
"baz": true
214+
},
215+
"required": ["bar"]
216+
},
217+
{
218+
"properties": {
219+
"foo": true
220+
},
221+
"required": ["foo"]
222+
}
223+
]
224+
},
225+
"tests": [
226+
{
227+
"description": "first oneOf valid",
228+
"data": {"bar": 8},
229+
"valid": true
230+
},
231+
{
232+
"description": "second oneOf valid",
233+
"data": {"foo": "foo"},
234+
"valid": true
235+
},
236+
{
237+
"description": "both oneOf valid",
238+
"data": {"foo": "foo", "bar": 8},
239+
"valid": false
240+
},
241+
{
242+
"description": "neither oneOf valid",
243+
"data": {"baz": "quux"},
244+
"valid": false
245+
}
246+
]
205247
}
206248
]

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@
3030
]
3131
},
3232
{
33-
"description": "ECMA 262 regex converts \\a to ascii BEL",
33+
"description": "ECMA 262 regex converts \\t to horizontal tab",
3434
"schema": {
3535
"type": "string",
36-
"pattern": "^\\a$"
36+
"pattern": "^\\t$"
3737
},
3838
"tests": [
3939
{
4040
"description": "does not match",
41-
"data": "\\a",
41+
"data": "\\t",
4242
"valid": false
4343
},
4444
{
4545
"description": "matches",
46-
"data": "\u0007",
46+
"data": "\u0009",
4747
"valid": true
4848
}
4949
]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[
2+
{
3+
"description": "can peer inside allOf, results in no-op",
4+
"schema": {
5+
"$schema": "https://json-schema.org/draft/2019-09/schema",
6+
"unevaluatedProperties": false,
7+
"allOf": [
8+
{
9+
"properties": {
10+
"foo": { "type": ["string", "null"] },
11+
"bar": { "type": ["string", "null"] }
12+
}
13+
},
14+
{
15+
"additionalProperties": {
16+
"not": { "enum": [ null ] }
17+
}
18+
}
19+
]
20+
},
21+
"tests": [
22+
{
23+
"description": "string props valid",
24+
"data": { "bar": "foo", "bob": "who?" },
25+
"valid": true
26+
},
27+
{
28+
"description": "null prop is invalid",
29+
"data": { "bar": "foo", "bob": null },
30+
"valid": false
31+
}
32+
]
33+
}
34+
]

tests/draft4/oneOf.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,5 +158,47 @@
158158
"valid": false
159159
}
160160
]
161+
},
162+
{
163+
"description": "oneOf with missing optional property",
164+
"schema": {
165+
"oneOf": [
166+
{
167+
"properties": {
168+
"bar": {},
169+
"baz": {}
170+
},
171+
"required": ["bar"]
172+
},
173+
{
174+
"properties": {
175+
"foo": {}
176+
},
177+
"required": ["foo"]
178+
}
179+
]
180+
},
181+
"tests": [
182+
{
183+
"description": "first oneOf valid",
184+
"data": {"bar": 8},
185+
"valid": true
186+
},
187+
{
188+
"description": "second oneOf valid",
189+
"data": {"foo": "foo"},
190+
"valid": true
191+
},
192+
{
193+
"description": "both oneOf valid",
194+
"data": {"foo": "foo", "bar": 8},
195+
"valid": false
196+
},
197+
{
198+
"description": "neither oneOf valid",
199+
"data": {"baz": "quux"},
200+
"valid": false
201+
}
202+
]
161203
}
162204
]

tests/draft4/optional/ecmascript-regex.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@
3030
]
3131
},
3232
{
33-
"description": "ECMA 262 regex converts \\a to ascii BEL",
33+
"description": "ECMA 262 regex converts \\t to horizontal tab",
3434
"schema": {
3535
"type": "string",
36-
"pattern": "^\\a$"
36+
"pattern": "^\\t$"
3737
},
3838
"tests": [
3939
{
4040
"description": "does not match",
41-
"data": "\\a",
41+
"data": "\\t",
4242
"valid": false
4343
},
4444
{
4545
"description": "matches",
46-
"data": "\u0007",
46+
"data": "\u0009",
4747
"valid": true
4848
}
4949
]

tests/draft6/oneOf.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,5 +202,47 @@
202202
"valid": false
203203
}
204204
]
205+
},
206+
{
207+
"description": "oneOf with missing optional property",
208+
"schema": {
209+
"oneOf": [
210+
{
211+
"properties": {
212+
"bar": true,
213+
"baz": true
214+
},
215+
"required": ["bar"]
216+
},
217+
{
218+
"properties": {
219+
"foo": true
220+
},
221+
"required": ["foo"]
222+
}
223+
]
224+
},
225+
"tests": [
226+
{
227+
"description": "first oneOf valid",
228+
"data": {"bar": 8},
229+
"valid": true
230+
},
231+
{
232+
"description": "second oneOf valid",
233+
"data": {"foo": "foo"},
234+
"valid": true
235+
},
236+
{
237+
"description": "both oneOf valid",
238+
"data": {"foo": "foo", "bar": 8},
239+
"valid": false
240+
},
241+
{
242+
"description": "neither oneOf valid",
243+
"data": {"baz": "quux"},
244+
"valid": false
245+
}
246+
]
205247
}
206248
]

tests/draft6/optional/ecmascript-regex.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@
3030
]
3131
},
3232
{
33-
"description": "ECMA 262 regex converts \\a to ascii BEL",
33+
"description": "ECMA 262 regex converts \\t to horizontal tab",
3434
"schema": {
3535
"type": "string",
36-
"pattern": "^\\a$"
36+
"pattern": "^\\t$"
3737
},
3838
"tests": [
3939
{
4040
"description": "does not match",
41-
"data": "\\a",
41+
"data": "\\t",
4242
"valid": false
4343
},
4444
{
4545
"description": "matches",
46-
"data": "\u0007",
46+
"data": "\u0009",
4747
"valid": true
4848
}
4949
]

tests/draft7/oneOf.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,5 +202,47 @@
202202
"valid": false
203203
}
204204
]
205+
},
206+
{
207+
"description": "oneOf with missing optional property",
208+
"schema": {
209+
"oneOf": [
210+
{
211+
"properties": {
212+
"bar": true,
213+
"baz": true
214+
},
215+
"required": ["bar"]
216+
},
217+
{
218+
"properties": {
219+
"foo": true
220+
},
221+
"required": ["foo"]
222+
}
223+
]
224+
},
225+
"tests": [
226+
{
227+
"description": "first oneOf valid",
228+
"data": {"bar": 8},
229+
"valid": true
230+
},
231+
{
232+
"description": "second oneOf valid",
233+
"data": {"foo": "foo"},
234+
"valid": true
235+
},
236+
{
237+
"description": "both oneOf valid",
238+
"data": {"foo": "foo", "bar": 8},
239+
"valid": false
240+
},
241+
{
242+
"description": "neither oneOf valid",
243+
"data": {"baz": "quux"},
244+
"valid": false
245+
}
246+
]
205247
}
206248
]

tests/draft7/optional/ecmascript-regex.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@
3030
]
3131
},
3232
{
33-
"description": "ECMA 262 regex converts \\a to ascii BEL",
33+
"description": "ECMA 262 regex converts \\t to horizontal tab",
3434
"schema": {
3535
"type": "string",
36-
"pattern": "^\\a$"
36+
"pattern": "^\\t$"
3737
},
3838
"tests": [
3939
{
4040
"description": "does not match",
41-
"data": "\\a",
41+
"data": "\\t",
4242
"valid": false
4343
},
4444
{
4545
"description": "matches",
46-
"data": "\u0007",
46+
"data": "\u0009",
4747
"valid": true
4848
}
4949
]

0 commit comments

Comments
 (0)