Skip to content

Commit 0e2b4ee

Browse files
authored
Merge pull request #643 from 0xSudarshan/main
Added test for schema-items alongside "ignored" additionalItems
2 parents c49ba54 + f0e5ce7 commit 0e2b4ee

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

tests/draft2019-09/additionalItems.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,30 @@
2121
},
2222
{
2323
"description": "when items is schema, additionalItems does nothing",
24+
"schema": {
25+
"$schema":"https://json-schema.org/draft/2019-09/schema",
26+
"items": {
27+
"type": "integer"
28+
},
29+
"additionalItems": {
30+
"type": "string"
31+
}
32+
},
33+
"tests": [
34+
{
35+
"description": "valid with a array of type integers",
36+
"data": [1,2,3],
37+
"valid": true
38+
},
39+
{
40+
"description": "invalid with a array of mixed types",
41+
"data": [1,"2","3"],
42+
"valid": false
43+
}
44+
]
45+
},
46+
{
47+
"description": "when items is schema, boolean additionalItems does nothing",
2448
"schema": {
2549
"$schema": "https://json-schema.org/draft/2019-09/schema",
2650
"items": {},

tests/draft6/additionalItems.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,29 @@
2020
},
2121
{
2222
"description": "when items is schema, additionalItems does nothing",
23+
"schema": {
24+
"items": {
25+
"type": "integer"
26+
},
27+
"additionalItems": {
28+
"type": "string"
29+
}
30+
},
31+
"tests": [
32+
{
33+
"description": "valid with a array of type integers",
34+
"data": [1,2,3],
35+
"valid": true
36+
},
37+
{
38+
"description": "invalid with a array of mixed types",
39+
"data": [1,"2","3"],
40+
"valid": false
41+
}
42+
]
43+
},
44+
{
45+
"description": "when items is schema, boolean additionalItems does nothing",
2346
"schema": {
2447
"items": {},
2548
"additionalItems": false

tests/draft7/additionalItems.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,29 @@
2020
},
2121
{
2222
"description": "when items is schema, additionalItems does nothing",
23+
"schema": {
24+
"items": {
25+
"type": "integer"
26+
},
27+
"additionalItems": {
28+
"type": "string"
29+
}
30+
},
31+
"tests": [
32+
{
33+
"description": "valid with a array of type integers",
34+
"data": [1,2,3],
35+
"valid": true
36+
},
37+
{
38+
"description": "invalid with a array of mixed types",
39+
"data": [1,"2","3"],
40+
"valid": false
41+
}
42+
]
43+
},
44+
{
45+
"description": "when items is schema, boolean additionalItems does nothing",
2346
"schema": {
2447
"items": {},
2548
"additionalItems": false

0 commit comments

Comments
 (0)