Skip to content

Commit

Permalink
Test unevaluatedItems|Properties before $ref
Browse files Browse the repository at this point in the history
  • Loading branch information
marksparkza committed Nov 19, 2023
1 parent 0433a2b commit 4a2c61e
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/draft-next/unevaluatedItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,37 @@
}
]
},
{
"description": "unevaluatedItems before $ref",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"unevaluatedItems": false,
"prefixItems": [
{ "type": "string" }
],
"$ref": "#/$defs/bar",
"$defs": {
"bar": {
"prefixItems": [
true,
{ "type": "string" }
]
}
}
},
"tests": [
{
"description": "with no unevaluated items",
"data": ["foo", "bar"],
"valid": true
},
{
"description": "with unevaluated items",
"data": ["foo", "bar", "baz"],
"valid": false
}
]
},
{
"description": "unevaluatedItems with $dynamicRef",
"schema": {
Expand Down
38 changes: 38 additions & 0 deletions tests/draft-next/unevaluatedProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,44 @@
}
]
},
{
"description": "unevaluatedProperties before $ref",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"type": "object",
"unevaluatedProperties": false,
"properties": {
"foo": { "type": "string" }
},
"$ref": "#/$defs/bar",
"$defs": {
"bar": {
"properties": {
"bar": { "type": "string" }
}
}
}
},
"tests": [
{
"description": "with no unevaluated properties",
"data": {
"foo": "foo",
"bar": "bar"
},
"valid": true
},
{
"description": "with unevaluated properties",
"data": {
"foo": "foo",
"bar": "bar",
"baz": "baz"
},
"valid": false
}
]
},
{
"description": "unevaluatedProperties with $dynamicRef",
"schema": {
Expand Down
31 changes: 31 additions & 0 deletions tests/draft2019-09/unevaluatedItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,37 @@
}
]
},
{
"description": "unevaluatedItems before $ref",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"unevaluatedItems": false,
"items": [
{ "type": "string" }
],
"$ref": "#/$defs/bar",
"$defs": {
"bar": {
"items": [
true,
{ "type": "string" }
]
}
}
},
"tests": [
{
"description": "with no unevaluated items",
"data": ["foo", "bar"],
"valid": true
},
{
"description": "with unevaluated items",
"data": ["foo", "bar", "baz"],
"valid": false
}
]
},
{
"description": "unevaluatedItems with $recursiveRef",
"schema": {
Expand Down
38 changes: 38 additions & 0 deletions tests/draft2019-09/unevaluatedProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,44 @@
}
]
},
{
"description": "unevaluatedProperties before $ref",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"type": "object",
"unevaluatedProperties": false,
"properties": {
"foo": { "type": "string" }
},
"$ref": "#/$defs/bar",
"$defs": {
"bar": {
"properties": {
"bar": { "type": "string" }
}
}
}
},
"tests": [
{
"description": "with no unevaluated properties",
"data": {
"foo": "foo",
"bar": "bar"
},
"valid": true
},
{
"description": "with unevaluated properties",
"data": {
"foo": "foo",
"bar": "bar",
"baz": "baz"
},
"valid": false
}
]
},
{
"description": "unevaluatedProperties with $recursiveRef",
"schema": {
Expand Down
31 changes: 31 additions & 0 deletions tests/draft2020-12/unevaluatedItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,37 @@
}
]
},
{
"description": "unevaluatedItems before $ref",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"unevaluatedItems": false,
"prefixItems": [
{ "type": "string" }
],
"$ref": "#/$defs/bar",
"$defs": {
"bar": {
"prefixItems": [
true,
{ "type": "string" }
]
}
}
},
"tests": [
{
"description": "with no unevaluated items",
"data": ["foo", "bar"],
"valid": true
},
{
"description": "with unevaluated items",
"data": ["foo", "bar", "baz"],
"valid": false
}
]
},
{
"description": "unevaluatedItems with $dynamicRef",
"schema": {
Expand Down
38 changes: 38 additions & 0 deletions tests/draft2020-12/unevaluatedProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,44 @@
}
]
},
{
"description": "unevaluatedProperties before $ref",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"unevaluatedProperties": false,
"properties": {
"foo": { "type": "string" }
},
"$ref": "#/$defs/bar",
"$defs": {
"bar": {
"properties": {
"bar": { "type": "string" }
}
}
}
},
"tests": [
{
"description": "with no unevaluated properties",
"data": {
"foo": "foo",
"bar": "bar"
},
"valid": true
},
{
"description": "with unevaluated properties",
"data": {
"foo": "foo",
"bar": "bar",
"baz": "baz"
},
"valid": false
}
]
},
{
"description": "unevaluatedProperties with $dynamicRef",
"schema": {
Expand Down

0 comments on commit 4a2c61e

Please sign in to comment.