Skip to content

Tests for dependentSchema and propertyDependencies with unevaluatedPro… #732

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 7 commits into from
Apr 15, 2024
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
68 changes: 68 additions & 0 deletions tests/draft-next/additionalProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,73 @@
"valid": false
}
]
},
{
"description": "propertyDependencies with additionalProperties",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"properties" : {"foo2" : {}},
"propertyDependencies": {
"foo" : {},
"foo2": {
"bar": {
"properties": {
"buz": {}
}
}
}
},
"additionalProperties": false
},
"tests": [
{
"description": "additionalProperties doesn't consider propertyDependencies properties" ,
"data": {"foo": ""},
"valid": false
},
{
"description": "additionalProperties can't see buz even when foo2 is present",
"data": {"foo2": "bar", "buz": ""},
"valid": false
},
{
"description": "additionalProperties can't see buz",
"data": {"buz": ""},
"valid": false
}
]
},
{
"description": "dependentSchemas with additionalProperties",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"properties": {"foo2": {}},
"dependentSchemas": {
"foo": {},
"foo2": {
"properties": {
"bar": {}
}
}
},
"additionalProperties": false
},
"tests": [
{
"description": "additionalProperties doesn't consider dependentSchemas",
"data": {"foo": ""},
"valid": false
},
{
"description": "additionalProperties can't see bar",
"data": {"bar": ""},
"valid": false
},
{
"description": "additionalProperties can't see bar even when foo2 is present",
"data": {"foo2": "", "bar": ""},
"valid": false
}
]
}
]
69 changes: 69 additions & 0 deletions tests/draft-next/unevaluatedProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -1603,5 +1603,74 @@
"valid": false
}
]
},
{
"description": "propertyDependencies with unevaluatedProperties" ,
"schema" : {
"$schema": "https://json-schema.org/draft/next/schema",
"properties" : {"foo2" : {}},
"propertyDependencies": {
"foo" : {},
"foo2": {
"bar": {
"properties": {
"buz": {}
}
}
}
},
"unevaluatedProperties": false
},

"tests": [
{
"description": "unevaluatedProperties doesn't consider propertyDependencies" ,
"data": {"foo": "bar"},
"valid": false
},
{
"description": "unevaluatedProperties sees buz when foo2 is present",
"data": {"foo2": "bar", "buz": ""},
"valid": true
},
{
"description": "unevaluatedProperties doesn't see buz when foo2 is absent",
"data": {"buz": ""},
"valid": false
}
]
},
{
"description": "dependentSchemas with unevaluatedProperties",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"properties": {"foo2": {}},
"dependentSchemas": {
"foo" : {},
"foo2": {
"properties": {
"bar":{}
}
}
},
"unevaluatedProperties": false
},
"tests": [
{
"description": "unevaluatedProperties doesn't consider dependentSchemas",
"data": {"foo": ""},
"valid": false
},
{
"description": "unevaluatedProperties doesn't see bar when foo2 is absent",
"data": {"bar": ""},
"valid": false
},
{
"description": "unevaluatedProperties sees bar when foo2 is present",
"data": {"foo2": "", "bar": ""},
"valid": true
}
]
}
]
33 changes: 33 additions & 0 deletions tests/draft2019-09/additionalProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,38 @@
"valid": false
}
]
},
{
"description": "dependentSchemas with additionalProperties",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"properties": {"foo2": {}},
"dependentSchemas": {
"foo" : {},
"foo2": {
"properties": {
"bar":{}
}
}
},
"additionalProperties": false
},
"tests": [
{
"description": "additionalProperties doesn't consider dependentSchemas",
"data": {"foo": ""},
"valid": false
},
{
"description": "additionalProperties can't see bar",
"data": {"bar": ""},
"valid": false
},
{
"description": "additionalProperties can't see bar even when foo2 is present",
"data": { "foo2": "", "bar": ""},
"valid": false
}
]
}
]
33 changes: 33 additions & 0 deletions tests/draft2019-09/unevaluatedProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -1567,5 +1567,38 @@
"valid": false
}
]
},
{
"description": "dependentSchemas with unevaluatedProperties",
"schema": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"properties": {"foo2": {}},
"dependentSchemas": {
"foo" : {},
"foo2": {
"properties": {
"bar":{}
}
}
},
"unevaluatedProperties": false
},
"tests": [
{
"description": "unevaluatedProperties doesn't consider dependentSchemas",
"data": {"foo": ""},
"valid": false
},
{
"description": "unevaluatedProperties doesn't see bar when foo2 is absent",
"data": {"bar": ""},
"valid": false
},
{
"description": "unevaluatedProperties sees bar when foo2 is present",
"data": { "foo2": "", "bar": ""},
"valid": true
}
]
}
]
33 changes: 33 additions & 0 deletions tests/draft2020-12/additionalProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,38 @@
"valid": false
}
]
},
{
"description": "dependentSchemas with additionalProperties",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {"foo2": {}},
"dependentSchemas": {
"foo" : {},
"foo2": {
"properties": {
"bar": {}
}
}
},
"additionalProperties": false
},
"tests": [
{
"description": "additionalProperties doesn't consider dependentSchemas",
"data": {"foo": ""},
"valid": false
},
{
"description": "additionalProperties can't see bar",
"data": {"bar": ""},
"valid": false
},
{
"description": "additionalProperties can't see bar even when foo2 is present",
"data": {"foo2": "", "bar": ""},
"valid": false
}
]
}
]
1 change: 0 additions & 1 deletion tests/draft2020-12/unevaluatedItems.json
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,6 @@
"data": [ "b" ],
"valid": false
}

]
}
]
33 changes: 33 additions & 0 deletions tests/draft2020-12/unevaluatedProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -1564,5 +1564,38 @@
"valid": false
}
]
},
{
"description": "dependentSchemas with unevaluatedProperties",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {"foo2": {}},
"dependentSchemas": {
"foo" : {},
"foo2": {
"properties": {
"bar":{}
}
}
},
"unevaluatedProperties": false
},
"tests": [
{
"description": "unevaluatedProperties doesn't consider dependentSchemas",
"data": {"foo": ""},
"valid": false
},
{
"description": "unevaluatedProperties doesn't see bar when foo2 is absent",
"data": {"bar": ""},
"valid": false
},
{
"description": "unevaluatedProperties sees bar when foo2 is present",
"data": { "foo2": "", "bar": ""},
"valid": true
}
]
}
]
Loading