Skip to content

Commit 3b4aa99

Browse files
committed
Re-add the future keywords tests.
The intent of them is *not* to express that an implementation might wish to recognize these keywords. The intent of them is precisely the same as the original intent -- to allow an implementation to test itself for *not* recognizing new keywords. Such an implementation should enable these tests, as it is free to do so, and these tests will help ensure it does not accidentally leak newer keywords backwards in time if it doesn't mean to. All of the previous discussion was strictly centered on not putting these in the required directory. The reason is that all drafts *allow* implementations to add extra keywords. So a compliant implementation may indeed decide it actively *wants* to implement new keywords. Then this file would not help them, and they wouldn't run it. They would presumably love a version of this file that *did* contain all the future assertions as correct for future drafts, and in the future we could provide one. But given no implementations really do do this, at least as far as I'm aware, and given that this version of the file is here and written and more common, it would seem perfectly reasonable to have it and hope for the other version if or when someone wants it. Further discussion is in #383 and later #559. This reverts commit f605fbf.
1 parent d3f5cd4 commit 3b4aa99

File tree

4 files changed

+1518
-0
lines changed

4 files changed

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

0 commit comments

Comments
 (0)