Skip to content

Commit cd54068

Browse files
test that array-items/prefixItems adjusts the starting position for schema-items/additionalItems
1 parent 15ec577 commit cd54068

File tree

5 files changed

+95
-0
lines changed

5 files changed

+95
-0
lines changed

tests/draft2019-09/additionalItems.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,24 @@
126126
"valid": false
127127
}
128128
]
129+
},
130+
{
131+
"description": "items validation adjusts the starting index for additionalItems",
132+
"schema": {
133+
"items": [ { "type": "string" } ],
134+
"additionalItems": { "type": "integer" }
135+
},
136+
"tests": [
137+
{
138+
"description": "valid items",
139+
"data": [ "x", 2, 3 ],
140+
"valid": true
141+
},
142+
{
143+
"description": "wrong type of second item",
144+
"data": [ "x", "y" ],
145+
"valid": false
146+
}
147+
]
129148
}
130149
]

tests/draft2020-12/items.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,5 +233,24 @@
233233
"valid": true
234234
}
235235
]
236+
},
237+
{
238+
"description": "prefixItems validation adjusts the starting index for items",
239+
"schema": {
240+
"prefixItems": [ { "type": "string" } ],
241+
"items": { "type": "integer" }
242+
},
243+
"tests": [
244+
{
245+
"description": "valid items",
246+
"data": [ "x", 2, 3 ],
247+
"valid": true
248+
},
249+
{
250+
"description": "wrong type of second item",
251+
"data": [ "x", "y" ],
252+
"valid": false
253+
}
254+
]
236255
}
237256
]

tests/draft4/additionalItems.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,24 @@
126126
"valid": false
127127
}
128128
]
129+
},
130+
{
131+
"description": "items validation adjusts the starting index for additionalItems",
132+
"schema": {
133+
"items": [ { "type": "string" } ],
134+
"additionalItems": { "type": "integer" }
135+
},
136+
"tests": [
137+
{
138+
"description": "valid items",
139+
"data": [ "x", 2, 3 ],
140+
"valid": true
141+
},
142+
{
143+
"description": "wrong type of second item",
144+
"data": [ "x", "y" ],
145+
"valid": false
146+
}
147+
]
129148
}
130149
]

tests/draft6/additionalItems.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,24 @@
126126
"valid": false
127127
}
128128
]
129+
},
130+
{
131+
"description": "items validation adjusts the starting index for additionalItems",
132+
"schema": {
133+
"items": [ { "type": "string" } ],
134+
"additionalItems": { "type": "integer" }
135+
},
136+
"tests": [
137+
{
138+
"description": "valid items",
139+
"data": [ "x", 2, 3 ],
140+
"valid": true
141+
},
142+
{
143+
"description": "wrong type of second item",
144+
"data": [ "x", "y" ],
145+
"valid": false
146+
}
147+
]
129148
}
130149
]

tests/draft7/additionalItems.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,24 @@
126126
"valid": false
127127
}
128128
]
129+
},
130+
{
131+
"description": "items validation adjusts the starting index for additionalItems",
132+
"schema": {
133+
"items": [ { "type": "string" } ],
134+
"additionalItems": { "type": "integer" }
135+
},
136+
"tests": [
137+
{
138+
"description": "valid items",
139+
"data": [ "x", 2, 3 ],
140+
"valid": true
141+
},
142+
{
143+
"description": "wrong type of second item",
144+
"data": [ "x", "y" ],
145+
"valid": false
146+
}
147+
]
129148
}
130149
]

0 commit comments

Comments
 (0)