Skip to content
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

Test interaction between unevaluatedProperties and additionalProperties #755

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
62 changes: 26 additions & 36 deletions tests/draft2020-12/unevaluatedProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"description": "unevaluatedProperties true",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"unevaluatedProperties": true
},
"tests": [
Expand All @@ -25,7 +24,6 @@
"description": "unevaluatedProperties schema",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"unevaluatedProperties": {
"type": "string",
"minLength": 3
Expand Down Expand Up @@ -57,7 +55,6 @@
"description": "unevaluatedProperties false",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"unevaluatedProperties": false
},
"tests": [
Expand All @@ -79,7 +76,6 @@
"description": "unevaluatedProperties with adjacent properties",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": { "type": "string" }
},
Expand Down Expand Up @@ -107,7 +103,6 @@
"description": "unevaluatedProperties with adjacent patternProperties",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"patternProperties": {
"^foo": { "type": "string" }
},
Expand All @@ -132,13 +127,9 @@
]
},
{
"description": "unevaluatedProperties with adjacent additionalProperties",
"description": "unevaluatedProperties with adjacent bool additionalProperties",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": { "type": "string" }
},
"additionalProperties": true,
"unevaluatedProperties": false
},
Expand All @@ -160,11 +151,35 @@
}
]
},
{
"description": "unevaluatedProperties with adjacent non-bool additionalProperties",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": { "type": "string" },
"unevaluatedProperties": false
},
"tests": [
{
"description": "with only valid additional properties",
"data": {
"foo": "foo"
},
"valid": true
},
{
"description": "with invalid additional properties",
"data": {
"foo": "foo",
"bar": 1
},
"valid": false
}
]
},
{
"description": "unevaluatedProperties with nested properties",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": { "type": "string" }
},
Expand Down Expand Up @@ -201,7 +216,6 @@
"description": "unevaluatedProperties with nested patternProperties",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": { "type": "string" }
},
Expand Down Expand Up @@ -238,7 +252,6 @@
"description": "unevaluatedProperties with nested additionalProperties",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": { "type": "string" }
},
Expand Down Expand Up @@ -271,7 +284,6 @@
"description": "unevaluatedProperties with nested unevaluatedProperties",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": { "type": "string" }
},
Expand Down Expand Up @@ -307,7 +319,6 @@
"description": "unevaluatedProperties with anyOf",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": { "type": "string" }
},
Expand Down Expand Up @@ -376,7 +387,6 @@
"description": "unevaluatedProperties with oneOf",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": { "type": "string" }
},
Expand Down Expand Up @@ -420,7 +430,6 @@
"description": "unevaluatedProperties with not",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": { "type": "string" }
},
Expand Down Expand Up @@ -449,7 +458,6 @@
"description": "unevaluatedProperties with if/then/else",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"if": {
"properties": {
"foo": { "const": "then" }
Expand Down Expand Up @@ -509,7 +517,6 @@
"description": "unevaluatedProperties with if/then/else, then not defined",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"if": {
"properties": {
"foo": { "const": "then" }
Expand Down Expand Up @@ -563,7 +570,6 @@
"description": "unevaluatedProperties with if/then/else, else not defined",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"if": {
"properties": {
"foo": { "const": "then" }
Expand Down Expand Up @@ -617,7 +623,6 @@
"description": "unevaluatedProperties with dependentSchemas",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": { "type": "string" }
},
Expand Down Expand Up @@ -653,7 +658,6 @@
"description": "unevaluatedProperties with boolean schemas",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": { "type": "string" }
},
Expand Down Expand Up @@ -681,7 +685,6 @@
"description": "unevaluatedProperties with $ref",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"$ref": "#/$defs/bar",
"properties": {
"foo": { "type": "string" }
Expand Down Expand Up @@ -719,7 +722,6 @@
"description": "unevaluatedProperties before $ref",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"unevaluatedProperties": false,
"properties": {
"foo": { "type": "string" }
Expand Down Expand Up @@ -773,7 +775,6 @@

"$comment": "unevaluatedProperties comes first so it's more likely to catch bugs with implementations that are sensitive to keyword ordering",
"unevaluatedProperties": false,
"type": "object",
"properties": {
"foo": { "type": "string" }
},
Expand Down Expand Up @@ -862,7 +863,6 @@
"description": "nested unevaluatedProperties, outer false, inner true, properties outside",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": { "type": "string" }
},
Expand Down Expand Up @@ -895,7 +895,6 @@
"description": "nested unevaluatedProperties, outer false, inner true, properties inside",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"allOf": [
{
"properties": {
Expand Down Expand Up @@ -928,7 +927,6 @@
"description": "nested unevaluatedProperties, outer true, inner false, properties outside",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": { "type": "string" }
},
Expand Down Expand Up @@ -961,7 +959,6 @@
"description": "nested unevaluatedProperties, outer true, inner false, properties inside",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"allOf": [
{
"properties": {
Expand Down Expand Up @@ -994,7 +991,6 @@
"description": "cousin unevaluatedProperties, true and false, true with properties",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"allOf": [
{
"properties": {
Expand Down Expand Up @@ -1029,7 +1025,6 @@
"description": "cousin unevaluatedProperties, true and false, false with properties",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"allOf": [
{
"unevaluatedProperties": true
Expand Down Expand Up @@ -1065,10 +1060,8 @@
"comment": "see https://stackoverflow.com/questions/66936884/deeply-nested-unevaluatedproperties-and-their-expectations",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": {
"type": "object",
"properties": {
"bar": {
"type": "string"
Expand Down Expand Up @@ -1117,7 +1110,6 @@
"description": "in-place applicator siblings, allOf has unevaluated",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"allOf": [
{
"properties": {
Expand Down Expand Up @@ -1163,7 +1155,6 @@
"description": "in-place applicator siblings, anyOf has unevaluated",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"allOf": [
{
"properties": {
Expand Down Expand Up @@ -1209,7 +1200,6 @@
"description": "unevaluatedProperties + single cyclic ref",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"x": { "$ref": "#" }
},
Expand Down
Loading