Skip to content

Commit 39d1d24

Browse files
authored
Merge pull request #317 from Relequestual/#291
Add tests for Single-schema items and unevaluatedItems
2 parents 1e0ebd2 + b683de5 commit 39d1d24

File tree

3 files changed

+82
-3
lines changed

3 files changed

+82
-3
lines changed

tests/draft-next/unevaluatedItems.json

+27-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,33 @@
149149
{
150150
"description": "unevaluatedItems with nested items",
151151
"schema": {
152-
"type": "array",
152+
"unevaluatedItems": {"type": "boolean"},
153+
"anyOf": [
154+
{ "items": {"type": "string"} },
155+
true
156+
]
157+
},
158+
"tests": [
159+
{
160+
"description": "with only (valid) additional items",
161+
"data": [true, false],
162+
"valid": true
163+
},
164+
{
165+
"description": "with no additional items",
166+
"data": ["yes", "no"],
167+
"valid": true
168+
},
169+
{
170+
"description": "with invalid additional item",
171+
"data": ["yes", false],
172+
"valid": false
173+
}
174+
]
175+
},
176+
{
177+
"description": "unevaluatedItems with nested prefixItems and items",
178+
"schema": {
153179
"allOf": [
154180
{
155181
"prefixItems": [

tests/draft2019-09/unevaluatedItems.json

+28-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,34 @@
147147
]
148148
},
149149
{
150-
"description": "unevaluatedItems with nested additionalItems",
150+
"description": "unevaluatedItems with nested items",
151+
"schema": {
152+
"unevaluatedItems": {"type": "boolean"},
153+
"anyOf": [
154+
{ "items": {"type": "string"} },
155+
true
156+
]
157+
},
158+
"tests": [
159+
{
160+
"description": "with only (valid) additional items",
161+
"data": [true, false],
162+
"valid": true
163+
},
164+
{
165+
"description": "with no additional items",
166+
"data": ["yes", "no"],
167+
"valid": true
168+
},
169+
{
170+
"description": "with invalid additional item",
171+
"data": ["yes", false],
172+
"valid": false
173+
}
174+
]
175+
},
176+
{
177+
"description": "unevaluatedItems with nested items and additionalItems",
151178
"schema": {
152179
"type": "array",
153180
"allOf": [

tests/draft2020-12/unevaluatedItems.json

+27-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,33 @@
149149
{
150150
"description": "unevaluatedItems with nested items",
151151
"schema": {
152-
"type": "array",
152+
"unevaluatedItems": {"type": "boolean"},
153+
"anyOf": [
154+
{ "items": {"type": "string"} },
155+
true
156+
]
157+
},
158+
"tests": [
159+
{
160+
"description": "with only (valid) additional items",
161+
"data": [true, false],
162+
"valid": true
163+
},
164+
{
165+
"description": "with no additional items",
166+
"data": ["yes", "no"],
167+
"valid": true
168+
},
169+
{
170+
"description": "with invalid additional item",
171+
"data": ["yes", false],
172+
"valid": false
173+
}
174+
]
175+
},
176+
{
177+
"description": "unevaluatedItems with nested prefixItems and items",
178+
"schema": {
153179
"allOf": [
154180
{
155181
"prefixItems": [

0 commit comments

Comments
 (0)