Skip to content

Commit 9b1364e

Browse files
author
Evgeny Poberezkin
authored
Merge pull request #158 from epoberezkin/contains
draft-06: contains keyword validation
2 parents 95b4648 + 9867b96 commit 9b1364e

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

tests/draft6/contains.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
[
2+
{
3+
"description": "contains keyword validation",
4+
"schema": {
5+
"contains": {"minimum": 5}
6+
},
7+
"tests": [
8+
{
9+
"description": "array with item matching schema (5) is valid",
10+
"data": [3, 4, 5],
11+
"valid": true
12+
},
13+
{
14+
"description": "array with item matching schema (6) is valid",
15+
"data": [3, 4, 6],
16+
"valid": true
17+
},
18+
{
19+
"description": "array with two items matching schema (5, 6) is valid",
20+
"data": [3, 4, 5, 6],
21+
"valid": true
22+
},
23+
{
24+
"description": "array without items matching schema is invalid",
25+
"data": [2, 3, 4],
26+
"valid": false
27+
},
28+
{
29+
"description": "empty array is invalid",
30+
"data": [],
31+
"valid": false
32+
},
33+
{
34+
"description": "not array is valid",
35+
"data": {},
36+
"valid": true
37+
}
38+
]
39+
},
40+
{
41+
"description": "contains keyword with const keyword",
42+
"schema": {
43+
"contains": { "const": 5 }
44+
},
45+
"tests": [
46+
{
47+
"description": "array with item 5 is valid",
48+
"data": [3, 4, 5],
49+
"valid": true
50+
},
51+
{
52+
"description": "array with two items 5 is valid",
53+
"data": [3, 4, 5, 5],
54+
"valid": true
55+
},
56+
{
57+
"description": "array without item 5 is invalid",
58+
"data": [1, 2, 3, 4],
59+
"valid": false
60+
}
61+
]
62+
}
63+
]

0 commit comments

Comments
 (0)