Skip to content

Commit

Permalink
Merge pull request #694 from json-schema-org/heterogeneous-additional…
Browse files Browse the repository at this point in the history
…Items

Add tests for heterogeneous arrays with additionalItems
  • Loading branch information
Julian authored Oct 30, 2023
2 parents 9c88a0b + b8da838 commit 95fe6ca
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/draft-next/items.json
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,26 @@
}
]
},
{
"description": "items with heterogeneous array",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"prefixItems": [{}],
"items": false
},
"tests": [
{
"description": "heterogeneous invalid instance",
"data": [ "foo", "bar", 37 ],
"valid": false
},
{
"description": "valid instance",
"data": [ null ],
"valid": true
}
]
},
{
"description": "items with null instance elements",
"schema": {
Expand Down
20 changes: 20 additions & 0 deletions tests/draft2019-09/additionalItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,26 @@
}
]
},
{
"description": "additionalItems with heterogeneous array",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"items": [{}],
"additionalItems": false
},
"tests": [
{
"description": "heterogeneous invalid instance",
"data": [ "foo", "bar", 37 ],
"valid": false
},
{
"description": "valid instance",
"data": [ null ],
"valid": true
}
]
},
{
"description": "additionalItems with null instance elements",
"schema": {
Expand Down
20 changes: 20 additions & 0 deletions tests/draft2020-12/items.json
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,26 @@
}
]
},
{
"description": "items with heterogeneous array",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [{}],
"items": false
},
"tests": [
{
"description": "heterogeneous invalid instance",
"data": [ "foo", "bar", 37 ],
"valid": false
},
{
"description": "valid instance",
"data": [ null ],
"valid": true
}
]
},
{
"description": "items with null instance elements",
"schema": {
Expand Down
19 changes: 19 additions & 0 deletions tests/draft3/additionalItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,25 @@
}
]
},
{
"description": "additionalItems with heterogeneous array",
"schema": {
"items": [{}],
"additionalItems": false
},
"tests": [
{
"description": "heterogeneous invalid instance",
"data": [ "foo", "bar", 37 ],
"valid": false
},
{
"description": "valid instance",
"data": [ null ],
"valid": true
}
]
},
{
"description": "additionalItems with null instance elements",
"schema": {
Expand Down
19 changes: 19 additions & 0 deletions tests/draft4/additionalItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,25 @@
}
]
},
{
"description": "additionalItems with heterogeneous array",
"schema": {
"items": [{}],
"additionalItems": false
},
"tests": [
{
"description": "heterogeneous invalid instance",
"data": [ "foo", "bar", 37 ],
"valid": false
},
{
"description": "valid instance",
"data": [ null ],
"valid": true
}
]
},
{
"description": "additionalItems with null instance elements",
"schema": {
Expand Down
19 changes: 19 additions & 0 deletions tests/draft6/additionalItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,25 @@
}
]
},
{
"description": "additionalItems with heterogeneous array",
"schema": {
"items": [{}],
"additionalItems": false
},
"tests": [
{
"description": "heterogeneous invalid instance",
"data": [ "foo", "bar", 37 ],
"valid": false
},
{
"description": "valid instance",
"data": [ null ],
"valid": true
}
]
},
{
"description": "additionalItems with null instance elements",
"schema": {
Expand Down
19 changes: 19 additions & 0 deletions tests/draft7/additionalItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,25 @@
}
]
},
{
"description": "additionalItems with heterogeneous array",
"schema": {
"items": [{}],
"additionalItems": false
},
"tests": [
{
"description": "heterogeneous invalid instance",
"data": [ "foo", "bar", 37 ],
"valid": false
},
{
"description": "valid instance",
"data": [ null ],
"valid": true
}
]
},
{
"description": "additionalItems with null instance elements",
"schema": {
Expand Down

0 comments on commit 95fe6ca

Please sign in to comment.