Skip to content

more test cases for unevaluatedItems, unevaluatedProperties #472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions tests/draft2019-09/unevaluatedItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -433,5 +433,57 @@
"valid": false
}
]
},
{
"description": "item is evaluated in an uncle schema to unevaluatedItems",
"schema": {
"type": "object",
"properties": {
"foo": {
"type": "array",
"items": [
{
"type": "string"
}
],
"unevaluatedItems": false
}
},
"anyOf": [
{
"properties": {
"foo": {
"items": [
true,
{
"type": "string"
}
]
}
}
}
]
},
"tests": [
{
"description": "no extra items",
"data": {
"foo": [
"test"
]
},
"valid": true
},
{
"description": "uncle keyword evaluation is not significant",
"data": {
"foo": [
"test",
"test"
]
},
"valid": false
}
]
}
]
142 changes: 142 additions & 0 deletions tests/draft2019-09/unevaluatedProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -809,5 +809,147 @@
"valid": false
}
]
},
{
"description": "property is evaluated in an uncle schema to unevaluatedProperties",
"comment": "see https://stackoverflow.com/questions/66936884/deeply-nested-unevaluatedproperties-and-their-expectations",
"schema": {
"type": "object",
"properties": {
"foo": {
"type": "object",
"properties": {
"bar": {
"type": "string"
}
},
"unevaluatedProperties": false
}
},
"anyOf": [
{
"properties": {
"foo": {
"properties": {
"faz": {
"type": "string"
}
}
}
}
}
]
},
"tests": [
{
"description": "no extra properties",
"data": {
"foo": {
"bar": "test"
}
},
"valid": true
},
{
"description": "uncle keyword evaluation is not significant",
"data": {
"foo": {
"bar": "test",
"faz": "test"
}
},
"valid": false
}
]
},
{
"description": "in-place applicator siblings, allOf has unevaluated",
"schema": {
"type": "object",
"allOf": [
{
"properties": {
"foo": true
},
"unevaluatedProperties": false
}
],
"anyOf": [
{
"properties": {
"bar": true
}
}
]
},
"tests": [
{
"description": "base case: both properties present",
"data": {
"foo": 1,
"bar": 1
},
"valid": false
},
{
"description": "in place applicator siblings, bar is missing",
"data": {
"foo": 1
},
"valid": true
},
{
"description": "in place applicator siblings, foo is missing",
"data": {
"bar": 1
},
"valid": false
}
]
},
{
"description": "in-place applicator siblings, anyOf has unevaluated",
"schema": {
"type": "object",
"allOf": [
{
"properties": {
"foo": true
}
}
],
"anyOf": [
{
"properties": {
"bar": true
},
"unevaluatedProperties": false
}
]
},
"tests": [
{
"description": "base case: both properties present",
"data": {
"foo": 1,
"bar": 1
},
"valid": false
},
{
"description": "in place applicator siblings, bar is missing",
"data": {
"foo": 1
},
"valid": false
},
{
"description": "in place applicator siblings, foo is missing",
"data": {
"bar": 1
},
"valid": true
}
]
}
]
52 changes: 52 additions & 0 deletions tests/draft2020-12/unevaluatedItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -433,5 +433,57 @@
"valid": false
}
]
},
{
"description": "item is evaluated in an uncle schema to unevaluatedItems",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "item is evaluated in an uncle schema to unevaluatedItems",
"description": "item is evaluated in a separate keyword branch to unevaluatedItems",

"schema": {
"type": "object",
"properties": {
"foo": {
"type": "array",
"prefixItems": [
{
"type": "string"
}
],
"unevaluatedItems": false
}
},
"anyOf": [
{
"properties": {
"foo": {
"prefixItems": [
true,
{
"type": "string"
}
]
}
}
}
]
},
"tests": [
{
"description": "no extra items",
"data": {
"foo": [
"test"
]
},
"valid": true
},
{
"description": "uncle keyword evaluation is not significant",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "uncle keyword evaluation is not significant",
"description": "evaluation of items in a separate keyword branch is not significant",

"data": {
"foo": [
"test",
"test"
]
},
"valid": false
}
]
}
]
Loading