Skip to content

Commit b666c20

Browse files
karenetheridgeJulian
authored andcommitted
sq - add $dynamic*, prefixItems to drafts 4,6,7 as well and fix keyword name
1 parent d14242e commit b666c20

File tree

4 files changed

+229
-1
lines changed

4 files changed

+229
-1
lines changed

tests/draft2019-09/future-keywords.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
{
3434
"description": "prefixItems: an array of schemas for items",
3535
"schema": {
36-
"items": [
36+
"prefixItems": [
3737
{"type": "integer"},
3838
{"type": "string"}
3939
]

tests/draft4/future-keywords.json

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,80 @@
11
[
2+
{
3+
"description": "$dynamicRef without $dynamicAnchor works like $ref",
4+
"schema": {
5+
"properties": {
6+
"foo": {"$dynamicRef": "#"}
7+
},
8+
"additionalProperties": false
9+
},
10+
"tests": [
11+
{
12+
"description": "match",
13+
"data": {"foo": false},
14+
"valid": true
15+
},
16+
{
17+
"description": "recursive match",
18+
"data": {"foo": {"foo": false}},
19+
"valid": true
20+
},
21+
{
22+
"description": "mismatch",
23+
"data": {"bar": false},
24+
"valid": false
25+
},
26+
{
27+
"description": "recursive mismatch (but $dynamicRef is ignored)",
28+
"data": {"foo": {"bar": false}},
29+
"valid": true
30+
}
31+
]
32+
},
33+
{
34+
"description": "prefixItems: an array of schemas for items",
35+
"schema": {
36+
"prefixItems": [
37+
{"type": "integer"},
38+
{"type": "string"}
39+
]
40+
},
41+
"tests": [
42+
{
43+
"description": "correct types",
44+
"data": [ 1, "foo" ],
45+
"valid": true
46+
},
47+
{
48+
"description": "wrong types",
49+
"data": [ "foo", 1 ],
50+
"valid": true
51+
},
52+
{
53+
"description": "incomplete array of items",
54+
"data": [ 1 ],
55+
"valid": true
56+
},
57+
{
58+
"description": "array with additional items",
59+
"data": [ 1, "foo", true ],
60+
"valid": true
61+
},
62+
{
63+
"description": "empty array",
64+
"data": [ ],
65+
"valid": true
66+
},
67+
{
68+
"description": "JavaScript pseudo-array is valid",
69+
"data": {
70+
"0": "invalid",
71+
"1": "valid",
72+
"length": 2
73+
},
74+
"valid": true
75+
}
76+
]
77+
},
278
{
379
"description": "dependentSchemas: single dependency",
480
"schema": {

tests/draft6/future-keywords.json

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,80 @@
11
[
2+
{
3+
"description": "$dynamicRef without $dynamicAnchor works like $ref",
4+
"schema": {
5+
"properties": {
6+
"foo": {"$dynamicRef": "#"}
7+
},
8+
"additionalProperties": false
9+
},
10+
"tests": [
11+
{
12+
"description": "match",
13+
"data": {"foo": false},
14+
"valid": true
15+
},
16+
{
17+
"description": "recursive match",
18+
"data": {"foo": {"foo": false}},
19+
"valid": true
20+
},
21+
{
22+
"description": "mismatch",
23+
"data": {"bar": false},
24+
"valid": false
25+
},
26+
{
27+
"description": "recursive mismatch (but $dynamicRef is ignored)",
28+
"data": {"foo": {"bar": false}},
29+
"valid": true
30+
}
31+
]
32+
},
33+
{
34+
"description": "prefixItems: an array of schemas for items",
35+
"schema": {
36+
"prefixItems": [
37+
{"type": "integer"},
38+
{"type": "string"}
39+
]
40+
},
41+
"tests": [
42+
{
43+
"description": "correct types",
44+
"data": [ 1, "foo" ],
45+
"valid": true
46+
},
47+
{
48+
"description": "wrong types",
49+
"data": [ "foo", 1 ],
50+
"valid": true
51+
},
52+
{
53+
"description": "incomplete array of items",
54+
"data": [ 1 ],
55+
"valid": true
56+
},
57+
{
58+
"description": "array with additional items",
59+
"data": [ 1, "foo", true ],
60+
"valid": true
61+
},
62+
{
63+
"description": "empty array",
64+
"data": [ ],
65+
"valid": true
66+
},
67+
{
68+
"description": "JavaScript pseudo-array is valid",
69+
"data": {
70+
"0": "invalid",
71+
"1": "valid",
72+
"length": 2
73+
},
74+
"valid": true
75+
}
76+
]
77+
},
278
{
379
"description": "dependentSchemas: single dependency",
480
"schema": {

tests/draft7/future-keywords.json

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,80 @@
11
[
2+
{
3+
"description": "$dynamicRef without $dynamicAnchor works like $ref",
4+
"schema": {
5+
"properties": {
6+
"foo": {"$dynamicRef": "#"}
7+
},
8+
"additionalProperties": false
9+
},
10+
"tests": [
11+
{
12+
"description": "match",
13+
"data": {"foo": false},
14+
"valid": true
15+
},
16+
{
17+
"description": "recursive match",
18+
"data": {"foo": {"foo": false}},
19+
"valid": true
20+
},
21+
{
22+
"description": "mismatch",
23+
"data": {"bar": false},
24+
"valid": false
25+
},
26+
{
27+
"description": "recursive mismatch (but $dynamicRef is ignored)",
28+
"data": {"foo": {"bar": false}},
29+
"valid": true
30+
}
31+
]
32+
},
33+
{
34+
"description": "prefixItems: an array of schemas for items",
35+
"schema": {
36+
"prefixItems": [
37+
{"type": "integer"},
38+
{"type": "string"}
39+
]
40+
},
41+
"tests": [
42+
{
43+
"description": "correct types",
44+
"data": [ 1, "foo" ],
45+
"valid": true
46+
},
47+
{
48+
"description": "wrong types",
49+
"data": [ "foo", 1 ],
50+
"valid": true
51+
},
52+
{
53+
"description": "incomplete array of items",
54+
"data": [ 1 ],
55+
"valid": true
56+
},
57+
{
58+
"description": "array with additional items",
59+
"data": [ 1, "foo", true ],
60+
"valid": true
61+
},
62+
{
63+
"description": "empty array",
64+
"data": [ ],
65+
"valid": true
66+
},
67+
{
68+
"description": "JavaScript pseudo-array is valid",
69+
"data": {
70+
"0": "invalid",
71+
"1": "valid",
72+
"length": 2
73+
},
74+
"valid": true
75+
}
76+
]
77+
},
278
{
379
"description": "dependentSchemas: single dependency",
480
"schema": {

0 commit comments

Comments
 (0)