Skip to content

Commit 88d6948

Browse files
authored
Merge pull request #573 from json-schema-org/handling-nulls-in-instances
Handling nulls in instances
2 parents 9cb7da9 + bd653f3 commit 88d6948

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+764
-0
lines changed

tests/draft-next/additionalProperties.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,20 @@
129129
"valid": false
130130
}
131131
]
132+
},
133+
{
134+
"description": "additionalProperties should properly handle null data",
135+
"schema": {
136+
"additionalProperties": {
137+
"type": "null"
138+
}
139+
},
140+
"tests": [
141+
{
142+
"description": "null properties allowed",
143+
"data": {"foo": null},
144+
"valid": true
145+
}
146+
]
132147
}
133148
]

tests/draft-next/contains.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,5 +237,20 @@
237237
"valid": false
238238
}
239239
]
240+
},
241+
{
242+
"description": "contains should properly handle null data",
243+
"schema": {
244+
"contains": {
245+
"type": "null"
246+
}
247+
},
248+
"tests": [
249+
{
250+
"description": "null items allowed",
251+
"data": [ null ],
252+
"valid": true
253+
}
254+
]
240255
}
241256
]

tests/draft-next/items.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,5 +252,20 @@
252252
"valid": false
253253
}
254254
]
255+
},
256+
{
257+
"description": "items should properly handle null data",
258+
"schema": {
259+
"items": {
260+
"type": "null"
261+
}
262+
},
263+
"tests": [
264+
{
265+
"description": "null items allowed",
266+
"data": [ null ],
267+
"valid": true
268+
}
269+
]
255270
}
256271
]

tests/draft-next/patternProperties.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,20 @@
152152
"valid": true
153153
}
154154
]
155+
},
156+
{
157+
"description": "patternProperties should properly handle null data",
158+
"schema": {
159+
"patternProperties": {
160+
"^.*bar$": {"type": "null"}
161+
}
162+
},
163+
"tests": [
164+
{
165+
"description": "null properties allowed",
166+
"data": {"foobar": null},
167+
"valid": true
168+
}
169+
]
155170
}
156171
]

tests/draft-next/prefixItems.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,22 @@
7777
"valid": true
7878
}
7979
]
80+
},
81+
{
82+
"description": "prefixItems should properly handle null data",
83+
"schema": {
84+
"prefixItems": [
85+
{
86+
"type": "null"
87+
}
88+
]
89+
},
90+
"tests": [
91+
{
92+
"description": "null items allowed",
93+
"data": [ null ],
94+
"valid": true
95+
}
96+
]
8097
}
8198
]

tests/draft-next/properties.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,20 @@
163163
"valid": false
164164
}
165165
]
166+
},
167+
{
168+
"description": "properties should properly handle null data",
169+
"schema": {
170+
"properties": {
171+
"foo": {"type": "null"}
172+
}
173+
},
174+
"tests": [
175+
{
176+
"description": "null properties allowed",
177+
"data": {"foo": null},
178+
"valid": true
179+
}
180+
]
166181
}
167182
]

tests/draft-next/unevaluatedItems.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,5 +625,20 @@
625625
"valid": true
626626
}
627627
]
628+
},
629+
{
630+
"description": "unevaluatedItems should properly handle null data",
631+
"schema": {
632+
"unevaluatedItems": {
633+
"type": "null"
634+
}
635+
},
636+
"tests": [
637+
{
638+
"description": "null items allowed",
639+
"data": [ null ],
640+
"valid": true
641+
}
642+
]
628643
}
629644
]

tests/draft2019-09/additionalItems.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,20 @@
145145
"valid": false
146146
}
147147
]
148+
},
149+
{
150+
"description": "additionalItems should properly handle null data",
151+
"schema": {
152+
"additionalItems": {
153+
"type": "null"
154+
}
155+
},
156+
"tests": [
157+
{
158+
"description": "null items allowed",
159+
"data": [ null ],
160+
"valid": true
161+
}
162+
]
148163
}
149164
]

tests/draft2019-09/additionalProperties.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,20 @@
129129
"valid": false
130130
}
131131
]
132+
},
133+
{
134+
"description": "additionalProperties should properly handle null data",
135+
"schema": {
136+
"additionalProperties": {
137+
"type": "null"
138+
}
139+
},
140+
"tests": [
141+
{
142+
"description": "null properties allowed",
143+
"data": {"foo": null},
144+
"valid": true
145+
}
146+
]
132147
}
133148
]

tests/draft2019-09/contains.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,20 @@
146146
"valid": false
147147
}
148148
]
149+
},
150+
{
151+
"description": "contains should properly handle null data",
152+
"schema": {
153+
"contains": {
154+
"type": "null"
155+
}
156+
},
157+
"tests": [
158+
{
159+
"description": "null items allowed",
160+
"data": [ null ],
161+
"valid": true
162+
}
163+
]
149164
}
150165
]

tests/draft2019-09/items.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,5 +246,37 @@
246246
"valid": false
247247
}
248248
]
249+
},
250+
{
251+
"description": "single-form items should properly handle null data",
252+
"schema": {
253+
"items": {
254+
"type": "null"
255+
}
256+
},
257+
"tests": [
258+
{
259+
"description": "null properties allowed",
260+
"data": [ null ],
261+
"valid": true
262+
}
263+
]
264+
},
265+
{
266+
"description": "array-form items should properly handle null data",
267+
"schema": {
268+
"items": [
269+
{
270+
"type": "null"
271+
}
272+
]
273+
},
274+
"tests": [
275+
{
276+
"description": "null items allowed",
277+
"data": [ null ],
278+
"valid": true
279+
}
280+
]
249281
}
250282
]

tests/draft2019-09/patternProperties.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,20 @@
152152
"valid": true
153153
}
154154
]
155+
},
156+
{
157+
"description": "patternProperties should properly handle null data",
158+
"schema": {
159+
"patternProperties": {
160+
"^.*bar$": {"type": "null"}
161+
}
162+
},
163+
"tests": [
164+
{
165+
"description": "null properties allowed",
166+
"data": {"foobar": null},
167+
"valid": true
168+
}
169+
]
155170
}
156171
]

tests/draft2019-09/properties.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,20 @@
163163
"valid": false
164164
}
165165
]
166+
},
167+
{
168+
"description": "properties should properly handle null data",
169+
"schema": {
170+
"properties": {
171+
"foo": {"type": "null"}
172+
}
173+
},
174+
"tests": [
175+
{
176+
"description": "null properties allowed",
177+
"data": {"foo": null},
178+
"valid": true
179+
}
180+
]
166181
}
167182
]

tests/draft2019-09/unevaluatedItems.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,5 +515,20 @@
515515
"valid": true
516516
}
517517
]
518+
},
519+
{
520+
"description": "unevaluatedItems should properly handle null data",
521+
"schema": {
522+
"unevaluatedItems": {
523+
"type": "null"
524+
}
525+
},
526+
"tests": [
527+
{
528+
"description": "null items allowed",
529+
"data": [ null ],
530+
"valid": true
531+
}
532+
]
518533
}
519534
]

tests/draft2019-09/unevaluatedProperties.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,5 +1343,20 @@
13431343
"valid": true
13441344
}
13451345
]
1346+
},
1347+
{
1348+
"description": "unevaluatedProperties should properly handle null data",
1349+
"schema": {
1350+
"unevaluatedProperties": {
1351+
"type": "null"
1352+
}
1353+
},
1354+
"tests": [
1355+
{
1356+
"description": "null properties allowed",
1357+
"data": {"foo": null},
1358+
"valid": true
1359+
}
1360+
]
13461361
}
13471362
]

tests/draft2020-12/additionalProperties.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,20 @@
129129
"valid": false
130130
}
131131
]
132+
},
133+
{
134+
"description": "additionalProperties should properly handle null data",
135+
"schema": {
136+
"additionalProperties": {
137+
"type": "null"
138+
}
139+
},
140+
"tests": [
141+
{
142+
"description": "null properties allowed",
143+
"data": {"foo": null},
144+
"valid": true
145+
}
146+
]
132147
}
133148
]

tests/draft2020-12/contains.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,20 @@
146146
"valid": false
147147
}
148148
]
149+
},
150+
{
151+
"description": "contains should properly handle null data",
152+
"schema": {
153+
"contains": {
154+
"type": "null"
155+
}
156+
},
157+
"tests": [
158+
{
159+
"description": "null items allowed",
160+
"data": [ null ],
161+
"valid": true
162+
}
163+
]
149164
}
150165
]

tests/draft2020-12/items.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,5 +252,20 @@
252252
"valid": false
253253
}
254254
]
255+
},
256+
{
257+
"description": "items should properly handle null data",
258+
"schema": {
259+
"items": {
260+
"type": "null"
261+
}
262+
},
263+
"tests": [
264+
{
265+
"description": "null items allowed",
266+
"data": [ null ],
267+
"valid": true
268+
}
269+
]
255270
}
256271
]

0 commit comments

Comments
 (0)