Skip to content

Commit 0da2aaa

Browse files
committed
Backport nested allOf/anyOf/oneOf tests
1 parent 34a2dfa commit 0da2aaa

File tree

9 files changed

+234
-0
lines changed

9 files changed

+234
-0
lines changed

tests/draft4/allOf.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,5 +181,31 @@
181181
"valid": false
182182
}
183183
]
184+
},
185+
{
186+
"description": "nested allOf, to check validation semantics",
187+
"schema": {
188+
"allOf": [
189+
{
190+
"allOf": [
191+
{
192+
"type": "null"
193+
}
194+
]
195+
}
196+
]
197+
},
198+
"tests": [
199+
{
200+
"description": "null is valid",
201+
"data": null,
202+
"valid": true
203+
},
204+
{
205+
"description": "anything non-null is invalid",
206+
"data": 123,
207+
"valid": false
208+
}
209+
]
184210
}
185211
]

tests/draft4/anyOf.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,32 @@
127127
}
128128
]
129129
},
130+
{
131+
"description": "nested anyOf, to check validation semantics",
132+
"schema": {
133+
"anyOf": [
134+
{
135+
"anyOf": [
136+
{
137+
"type": "null"
138+
}
139+
]
140+
}
141+
]
142+
},
143+
"tests": [
144+
{
145+
"description": "null is valid",
146+
"data": null,
147+
"valid": true
148+
},
149+
{
150+
"description": "anything non-null is invalid",
151+
"data": 123,
152+
"valid": false
153+
}
154+
]
155+
},
130156
{
131157
"description": "nested anyOf, to check validation semantics",
132158
"schema": {

tests/draft4/oneOf.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,5 +200,31 @@
200200
"valid": false
201201
}
202202
]
203+
},
204+
{
205+
"description": "nested oneOf, to check validation semantics",
206+
"schema": {
207+
"oneOf": [
208+
{
209+
"oneOf": [
210+
{
211+
"type": "null"
212+
}
213+
]
214+
}
215+
]
216+
},
217+
"tests": [
218+
{
219+
"description": "null is valid",
220+
"data": null,
221+
"valid": true
222+
},
223+
{
224+
"description": "anything non-null is invalid",
225+
"data": 123,
226+
"valid": false
227+
}
228+
]
203229
}
204230
]

tests/draft6/allOf.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,5 +214,31 @@
214214
"valid": false
215215
}
216216
]
217+
},
218+
{
219+
"description": "nested allOf, to check validation semantics",
220+
"schema": {
221+
"allOf": [
222+
{
223+
"allOf": [
224+
{
225+
"type": "null"
226+
}
227+
]
228+
}
229+
]
230+
},
231+
"tests": [
232+
{
233+
"description": "null is valid",
234+
"data": null,
235+
"valid": true
236+
},
237+
{
238+
"description": "anything non-null is invalid",
239+
"data": 123,
240+
"valid": false
241+
}
242+
]
217243
}
218244
]

tests/draft6/anyOf.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,32 @@
160160
}
161161
]
162162
},
163+
{
164+
"description": "nested anyOf, to check validation semantics",
165+
"schema": {
166+
"anyOf": [
167+
{
168+
"anyOf": [
169+
{
170+
"type": "null"
171+
}
172+
]
173+
}
174+
]
175+
},
176+
"tests": [
177+
{
178+
"description": "null is valid",
179+
"data": null,
180+
"valid": true
181+
},
182+
{
183+
"description": "anything non-null is invalid",
184+
"data": 123,
185+
"valid": false
186+
}
187+
]
188+
},
163189
{
164190
"description": "nested anyOf, to check validation semantics",
165191
"schema": {

tests/draft6/oneOf.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,5 +244,31 @@
244244
"valid": false
245245
}
246246
]
247+
},
248+
{
249+
"description": "nested oneOf, to check validation semantics",
250+
"schema": {
251+
"oneOf": [
252+
{
253+
"oneOf": [
254+
{
255+
"type": "null"
256+
}
257+
]
258+
}
259+
]
260+
},
261+
"tests": [
262+
{
263+
"description": "null is valid",
264+
"data": null,
265+
"valid": true
266+
},
267+
{
268+
"description": "anything non-null is invalid",
269+
"data": 123,
270+
"valid": false
271+
}
272+
]
247273
}
248274
]

tests/draft7/allOf.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,5 +214,31 @@
214214
"valid": false
215215
}
216216
]
217+
},
218+
{
219+
"description": "nested allOf, to check validation semantics",
220+
"schema": {
221+
"allOf": [
222+
{
223+
"allOf": [
224+
{
225+
"type": "null"
226+
}
227+
]
228+
}
229+
]
230+
},
231+
"tests": [
232+
{
233+
"description": "null is valid",
234+
"data": null,
235+
"valid": true
236+
},
237+
{
238+
"description": "anything non-null is invalid",
239+
"data": 123,
240+
"valid": false
241+
}
242+
]
217243
}
218244
]

tests/draft7/anyOf.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,32 @@
160160
}
161161
]
162162
},
163+
{
164+
"description": "nested anyOf, to check validation semantics",
165+
"schema": {
166+
"anyOf": [
167+
{
168+
"anyOf": [
169+
{
170+
"type": "null"
171+
}
172+
]
173+
}
174+
]
175+
},
176+
"tests": [
177+
{
178+
"description": "null is valid",
179+
"data": null,
180+
"valid": true
181+
},
182+
{
183+
"description": "anything non-null is invalid",
184+
"data": 123,
185+
"valid": false
186+
}
187+
]
188+
},
163189
{
164190
"description": "nested anyOf, to check validation semantics",
165191
"schema": {

tests/draft7/oneOf.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,5 +244,31 @@
244244
"valid": false
245245
}
246246
]
247+
},
248+
{
249+
"description": "nested oneOf, to check validation semantics",
250+
"schema": {
251+
"oneOf": [
252+
{
253+
"oneOf": [
254+
{
255+
"type": "null"
256+
}
257+
]
258+
}
259+
]
260+
},
261+
"tests": [
262+
{
263+
"description": "null is valid",
264+
"data": null,
265+
"valid": true
266+
},
267+
{
268+
"description": "anything non-null is invalid",
269+
"data": 123,
270+
"valid": false
271+
}
272+
]
247273
}
248274
]

0 commit comments

Comments
 (0)