Skip to content

Commit b3c8672

Browse files
authored
Merge pull request #587 from json-schema-org/cross-draft-tests
Cross draft tests
2 parents dfcea62 + e2a681a commit b3c8672

File tree

7 files changed

+112
-0
lines changed

7 files changed

+112
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$id": "http://localhost:1234/draft2019-09/dependentRequired.json",
3+
"$schema": "https://json-schema.org/draft/2019-09/schema",
4+
"dependentRequired": {
5+
"foo": ["bar"]
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$id": "http://localhost:1234/draft2019-09/ignore-prefixItems.json",
3+
"$schema": "https://json-schema.org/draft/2019-09/schema",
4+
"prefixItems": [
5+
{"type": "string"}
6+
]
7+
}

remotes/draft2020-12/prefixItems.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$id": "http://localhost:1234/draft2020-12/prefixItems.json",
3+
"$schema": "https://json-schema.org/draft/2020-12/schema",
4+
"prefixItems": [
5+
{"type": "string"}
6+
]
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$id": "http://localhost:1234/draft7/integer.json",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"dependentRequired": {
5+
"foo": ["bar"]
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[
2+
{
3+
"description": "refs to future drafts are processed as future drafts",
4+
"schema": {
5+
"$schema": "https://json-schema.org/draft/2019-09/schema",
6+
"type": "array",
7+
"$ref": "http://localhost:1234/draft2020-12/prefixItems.json"
8+
},
9+
"tests": [
10+
{
11+
"description": "first item not a string is invalid",
12+
"comment": "if the implementation is not processing the $ref as a 2020-12 schema, this test will fail",
13+
"data": [1, 2, 3],
14+
"valid": false
15+
},
16+
{
17+
"description": "first item is a string is valid",
18+
"data": ["a string", 1, 2, 3],
19+
"valid": true
20+
}
21+
]
22+
},
23+
{
24+
"description": "refs to historic drafts are processed as historic drafts",
25+
"schema": {
26+
"type": "object",
27+
"allOf": [
28+
{ "properties": { "foo": true } },
29+
{ "$ref": "http://localhost:1234/draft7/ignore-dependentRequired.json" }
30+
]
31+
},
32+
"tests": [
33+
{
34+
"description": "missing bar is valid",
35+
"comment": "if the implementation is not processing the $ref as a draft 7 schema, this test will fail",
36+
"data": {"foo": "any value"},
37+
"valid": true
38+
}
39+
]
40+
}
41+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[
2+
{
3+
"description": "refs to historic drafts are processed as historic drafts",
4+
"schema": {
5+
"$schema": "https://json-schema.org/draft/2020-12/schema",
6+
"type": "array",
7+
"$ref": "http://localhost:1234/draft2019-09/ignore-prefixItems.json"
8+
},
9+
"tests": [
10+
{
11+
"description": "first item not a string is valid",
12+
"comment": "if the implementation is not processing the $ref as a 2019-09 schema, this test will fail",
13+
"data": [1, 2, 3],
14+
"valid": true
15+
}
16+
]
17+
}
18+
]
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[
2+
{
3+
"description": "refs to future drafts are processed as future drafts",
4+
"schema": {
5+
"type": "object",
6+
"allOf": [
7+
{ "properties": { "foo": true } },
8+
{ "$ref": "http://localhost:1234/draft2019-09/dependentRequired.json" }
9+
]
10+
},
11+
"tests": [
12+
{
13+
"description": "missing bar is invalid",
14+
"comment": "if the implementation is not processing the $ref as a 2019-09 schema, this test will fail",
15+
"data": {"foo": "any value"},
16+
"valid": false
17+
},
18+
{
19+
"description": "present bar is valid",
20+
"data": {"foo": "any value", "bar": "also any value"},
21+
"valid": true
22+
}
23+
]
24+
}
25+
]

0 commit comments

Comments
 (0)