Skip to content

Commit b683de5

Browse files
committedJun 30, 2022
Forward-port and reword the new unevaluatedItems test.
Makes it fit a bit better with its neighbors by using similar language in the descriptions. This *precise* case seems uncovered by said neighbors because none precisely have all of: * nested unevaluatedItems * no prefixItems * cases where unevaluatedItems actually gets used for a scenario It's possible that in aggregate all the cases that are here already would catch any bugs this scenario would catch (i.e. it's possible this is redundant in aggregate) but it's safe enough to add just in case obviously.
1 parent 816441f commit b683de5

File tree

3 files changed

+63
-8
lines changed

3 files changed

+63
-8
lines changed
 

‎tests/draft-next/unevaluatedItems.json

Lines changed: 27 additions & 1 deletion
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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,31 +147,34 @@
147147
]
148148
},
149149
{
150-
"description": "Single-schema items and unevaluatedItems",
150+
"description": "unevaluatedItems with nested items",
151151
"schema": {
152152
"unevaluatedItems": {"type": "boolean"},
153-
"anyOf": [ { "items": {"type": "string"} }, true ]
153+
"anyOf": [
154+
{ "items": {"type": "string"} },
155+
true
156+
]
154157
},
155158
"tests": [
156159
{
157-
"description": "unevaluatedItems is applied",
160+
"description": "with only (valid) additional items",
158161
"data": [true, false],
159162
"valid": true
160163
},
161164
{
162-
"description": "unevaluatedItems isn't applied unnecessarily on items annotation boolean of true",
165+
"description": "with no additional items",
163166
"data": ["yes", "no"],
164167
"valid": true
165168
},
166169
{
167-
"description": "unevaluatedItems is applied on items annotation boolean false",
170+
"description": "with invalid additional item",
168171
"data": ["yes", false],
169172
"valid": false
170173
}
171174
]
172175
},
173176
{
174-
"description": "unevaluatedItems with nested additionalItems",
177+
"description": "unevaluatedItems with nested items and additionalItems",
175178
"schema": {
176179
"type": "array",
177180
"allOf": [

‎tests/draft2020-12/unevaluatedItems.json

Lines changed: 27 additions & 1 deletion
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)
Please sign in to comment.