Skip to content

Commit acfd00c

Browse files
karenetheridgeJulian
authored andcommitted
squash: contains does not exist in draft4
1 parent f506651 commit acfd00c

File tree

1 file changed

+42
-4
lines changed

1 file changed

+42
-4
lines changed

tests/draft4/future-keywords.json

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
{
217217
"description": "empty data",
218218
"data": [ ],
219-
"valid": false
219+
"valid": true
220220
},
221221
{
222222
"description": "all elements match, valid maxContains",
@@ -250,7 +250,7 @@
250250
{
251251
"description": "empty data",
252252
"data": [ ],
253-
"valid": false
253+
"valid": true
254254
},
255255
{
256256
"description": "all elements match, invalid minContains",
@@ -289,12 +289,12 @@
289289
{
290290
"description": "empty array is valid with minContains=0",
291291
"data": [ ],
292-
"valid": false
292+
"valid": true
293293
},
294294
{
295295
"description": "minContains = 0 would make contains always pass",
296296
"data": [ 2 ],
297-
"valid": false
297+
"valid": true
298298
}
299299
]
300300
},
@@ -314,6 +314,44 @@
314314
}
315315
]
316316
},
317+
{
318+
"description": "contains keyword validation",
319+
"schema": {
320+
"contains": {"minimum": 5}
321+
},
322+
"tests": [
323+
{
324+
"description": "array with item matching schema (5) is valid",
325+
"data": [3, 4, 5],
326+
"valid": true
327+
},
328+
{
329+
"description": "array with item matching schema (6) is valid",
330+
"data": [3, 4, 6],
331+
"valid": true
332+
},
333+
{
334+
"description": "array with two items matching schema (5, 6) is valid",
335+
"data": [3, 4, 5, 6],
336+
"valid": true
337+
},
338+
{
339+
"description": "array without items matching schema is invalid",
340+
"data": [2, 3, 4],
341+
"valid": false
342+
},
343+
{
344+
"description": "empty array is invalid",
345+
"data": [],
346+
"valid": false
347+
},
348+
{
349+
"description": "not array is valid",
350+
"data": {},
351+
"valid": true
352+
}
353+
]
354+
},
317355
{
318356
"description": "if with boolean schema false",
319357
"schema": { "if": false, "then": { "const": "then" }, "else": { "const": "else" } },

0 commit comments

Comments
 (0)