Skip to content

Commit deb8282

Browse files
committed
test for dependentSchema and propertyDependencies with unevaluatedProperties and additionalProperties
Signed-off-by: MeastroZI <[email protected]>
1 parent 64a3e7b commit deb8282

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed

tests/draft-next/propertyDependencies.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,5 +157,38 @@
157157
"valid": false
158158
}
159159
]
160+
},
161+
{
162+
"description": "propertyDependencies with additionalProperties",
163+
"schema": {
164+
"propertyDependencies" : {
165+
"foo": {"bar": {}}
166+
},
167+
"additionalProperties": false
168+
},
169+
"tests": [
170+
{
171+
"description": "propertyDependencies properties are count as additionalproperties" ,
172+
"data": {"foo": ""},
173+
"valid": false
174+
}
175+
]
176+
},
177+
{
178+
"description": "propertyDependencies with unevaluatedProperties" ,
179+
"schema" : {
180+
"propertyDependencies": {
181+
"foo": {"bar": {}}
182+
},
183+
"unevaluatedProperties": false
184+
},
185+
186+
"test": [
187+
{
188+
"description": "propertyDependencies properties are count as the unevaluatedProperties" ,
189+
"data": {"foo": ""},
190+
"valid": false
191+
}
192+
]
160193
}
161194
]

tests/draft2019-09/dependentSchemas.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,39 @@
167167
"valid": true
168168
}
169169
]
170+
},
171+
{
172+
"description": "dependent schema with additionalProperties",
173+
"schema": {
174+
"$schema": "https://json-schema.org/draft/2019-09/schema",
175+
"dependentSchemas": {
176+
"foo": {}
177+
},
178+
"additionalProperties": false
179+
},
180+
"tests": [
181+
{
182+
"description": "dependentSchemas properties are counted as additional properties",
183+
"data": {"foo": ""},
184+
"valid": false
185+
}
186+
]
187+
},
188+
{
189+
"description": "dependent schema with unevaluatedProperties",
190+
"schema": {
191+
"$schema": "https://json-schema.org/draft/2019-09/schema",
192+
"dependentSchemas": {
193+
"foo": {}
194+
},
195+
"unevaluatedProperties": false
196+
},
197+
"tests": [
198+
{
199+
"description": "dependentSchemas properties are counted as unevaluated properties",
200+
"data": {"foo": ""},
201+
"valid": false
202+
}
203+
]
170204
}
171205
]

tests/draft2020-12/dependentSchemas.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,39 @@
167167
"valid": true
168168
}
169169
]
170+
},
171+
{
172+
"description": "dependent schema with additionalProperties",
173+
"schema": {
174+
"$schema": "https://json-schema.org/draft/2020-12/schema",
175+
"dependentSchemas": {
176+
"foo": {}
177+
},
178+
"additionalProperties": false
179+
},
180+
"tests": [
181+
{
182+
"description": "dependentSchemas properties are counted as additional properties",
183+
"data": {"foo": ""},
184+
"valid": false
185+
}
186+
]
187+
},
188+
{
189+
"description": "dependent schema with unevaluatedProperties",
190+
"schema": {
191+
"$schema": "https://json-schema.org/draft/2020-12/schema",
192+
"dependentSchemas": {
193+
"foo": {}
194+
},
195+
"unevaluatedProperties": false
196+
},
197+
"tests": [
198+
{
199+
"description": "dependentSchemas properties are counted as unevaluated properties",
200+
"data": {"foo": ""},
201+
"valid": false
202+
}
203+
]
170204
}
171205
]

0 commit comments

Comments
 (0)