Skip to content

Commit 95b4648

Browse files
author
Evgeny Poberezkin
authored
Merge pull request #157 from epoberezkin/const
draft-06: const validation
2 parents 0799212 + ba6c582 commit 95b4648

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

tests/draft6/const.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
[
2+
{
3+
"description": "const validation",
4+
"schema": {"const": 2},
5+
"tests": [
6+
{
7+
"description": "same value is valid",
8+
"data": 2,
9+
"valid": true
10+
},
11+
{
12+
"description": "another value is invalid",
13+
"data": 5,
14+
"valid": false
15+
},
16+
{
17+
"description": "another type is invalid",
18+
"data": "a",
19+
"valid": false
20+
}
21+
]
22+
},
23+
{
24+
"description": "const with object",
25+
"schema": {"const": {"foo": "bar", "baz": "bax"}},
26+
"tests": [
27+
{
28+
"description": "same object is valid",
29+
"data": {"foo": "bar", "baz": "bax"},
30+
"valid": true
31+
},
32+
{
33+
"description": "same object with different property order is valid",
34+
"data": {"baz": "bax", "foo": "bar"},
35+
"valid": true
36+
},
37+
{
38+
"description": "another object is invalid",
39+
"data": {"foo": "bar"},
40+
"valid": false
41+
},
42+
{
43+
"description": "another type is invalid",
44+
"data": [1, 2],
45+
"valid": false
46+
}
47+
]
48+
},
49+
{
50+
"description": "const with null",
51+
"schema": {"const": null},
52+
"tests": [
53+
{
54+
"description": "null is valid",
55+
"data": null,
56+
"valid": true
57+
},
58+
{
59+
"description": "not null is invalid",
60+
"data": 0,
61+
"valid": false
62+
}
63+
]
64+
}
65+
]

0 commit comments

Comments
 (0)