Skip to content

Add a test for 2019's interaction between additional/unevaluatedItems #639

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 1 commit into from
Feb 22, 2023
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
23 changes: 22 additions & 1 deletion tests/draft-next/unevaluatedItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
]
},
{
"description": "unevaluatedItems with items",
"description": "unevaluatedItems with items and prefixItems",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"prefixItems": [
Expand All @@ -116,6 +116,27 @@
}
]
},
{
"description": "unevaluatedItems with items",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"items": {"type": "number"},
"unevaluatedItems": {"type": "string"}
},
"tests": [
{
"description": "valid under items",
"comment": "no elements are considered by unevaluatedItems",
"data": [5, 6, 7, 8],
"valid": true
},
{
"description": "invalid under items",
"data": ["foo", "bar", "baz"],
"valid": false
}
]
},
{
"description": "unevaluatedItems with nested tuple",
"schema": {
Expand Down
44 changes: 43 additions & 1 deletion tests/draft2019-09/unevaluatedItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
]
},
{
"description": "unevaluatedItems with additionalItems",
"description": "unevaluatedItems with items and additionalItems",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"items": [
Expand All @@ -116,6 +116,48 @@
}
]
},
{
"description": "unevaluatedItems with ignored additionalItems",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"additionalItems": {"type": "number"},
"unevaluatedItems": {"type": "string"}
},
"tests": [
{
"description": "invalid under unevaluatedItems",
"comment": "additionalItems is entirely ignored when items isn't present, so all elements need to be valid against the unevaluatedItems schema",
"data": ["foo", 1],
"valid": false
},
{
"description": "all valid under unevaluatedItems",
"data": ["foo", "bar", "baz"],
"valid": true
}
]
},
{
"description": "unevaluatedItems with ignored applicator additionalItems",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"allOf": [ { "additionalItems": { "type": "number" } } ],
"unevaluatedItems": {"type": "string"}
},
"tests": [
{
"description": "invalid under unevaluatedItems",
"comment": "additionalItems is entirely ignored when items isn't present, so all elements need to be valid against the unevaluatedItems schema",
"data": ["foo", 1],
"valid": false
},
{
"description": "all valid under unevaluatedItems",
"data": ["foo", "bar", "baz"],
"valid": true
}
]
},
{
"description": "unevaluatedItems with nested tuple",
"schema": {
Expand Down
23 changes: 22 additions & 1 deletion tests/draft2020-12/unevaluatedItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
]
},
{
"description": "unevaluatedItems with items",
"description": "unevaluatedItems with items and prefixItems",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [
Expand All @@ -116,6 +116,27 @@
}
]
},
{
"description": "unevaluatedItems with items",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"items": {"type": "number"},
"unevaluatedItems": {"type": "string"}
},
"tests": [
{
"description": "valid under items",
"comment": "no elements are considered by unevaluatedItems",
"data": [5, 6, 7, 8],
"valid": true
},
{
"description": "invalid under items",
"data": ["foo", "bar", "baz"],
"valid": false
}
]
},
{
"description": "unevaluatedItems with nested tuple",
"schema": {
Expand Down