Skip to content

Cross draft tests #587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions remotes/draft2019-09/dependentRequired.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$id": "http://localhost:1234/draft2019-09/dependentRequired.json",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"dependentRequired": {
"foo": ["bar"]
}
}
7 changes: 7 additions & 0 deletions remotes/draft2019-09/ignore-prefixItems.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$id": "http://localhost:1234/draft2019-09/ignore-prefixItems.json",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"prefixItems": [
{"type": "string"}
]
}
7 changes: 7 additions & 0 deletions remotes/draft2020-12/prefixItems.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$id": "http://localhost:1234/draft2020-12/prefixItems.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [
{"type": "string"}
]
}
7 changes: 7 additions & 0 deletions remotes/draft7/ignore-dependentRequired.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$id": "http://localhost:1234/draft7/integer.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"dependentRequired": {
"foo": ["bar"]
}
}
41 changes: 41 additions & 0 deletions tests/draft2019-09/optional/cross-draft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[
{
"description": "refs to future drafts are processed as future drafts",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"type": "array",
"$ref": "http://localhost:1234/draft2020-12/prefixItems.json"
},
"tests": [
{
"description": "first item not a string is invalid",
"comment": "if the implementation is not processing the $ref as a 2020-12 schema, this test will fail",
"data": [1, 2, 3],
"valid": false
},
{
"description": "first item is a string is valid",
"data": ["a string", 1, 2, 3],
"valid": true
}
]
},
{
"description": "refs to historic drafts are processed as historic drafts",
"schema": {
"type": "object",
"allOf": [
{ "properties": { "foo": true } },
{ "$ref": "http://localhost:1234/draft7/ignore-dependentRequired.json" }
]
},
"tests": [
{
"description": "missing bar is valid",
"comment": "if the implementation is not processing the $ref as a draft 7 schema, this test will fail",
"data": {"foo": "any value"},
"valid": true
}
]
}
]
18 changes: 18 additions & 0 deletions tests/draft2020-12/optional/cross-draft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"description": "refs to historic drafts are processed as historic drafts",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"$ref": "http://localhost:1234/draft2019-09/ignore-prefixItems.json"
},
"tests": [
{
"description": "first item not a string is valid",
"comment": "if the implementation is not processing the $ref as a 2019-09 schema, this test will fail",
"data": [1, 2, 3],
"valid": true
}
]
}
]
25 changes: 25 additions & 0 deletions tests/draft7/optional/cross-draft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
{
"description": "refs to future drafts are processed as future drafts",
"schema": {
"type": "object",
"allOf": [
{ "properties": { "foo": true } },
{ "$ref": "http://localhost:1234/draft2019-09/dependentRequired.json" }
]
},
"tests": [
{
"description": "missing bar is invalid",
"comment": "if the implementation is not processing the $ref as a 2019-09 schema, this test will fail",
"data": {"foo": "any value"},
"valid": false
},
{
"description": "present bar is valid",
"data": {"foo": "any value", "bar": "also any value"},
"valid": true
}
]
}
]