JSON-Schema-Test-Suite: Test that oneOf handles missing optional property
This shouldn’t really be necessary, but at least one validation library fails this test.
{
"description": "oneOf complex types",
"schema": {
"oneOf": [
{
"properties": {
"bar": {"type": "integer"}
/* , "baz": {"type": "boolean"} <-- new optional propery, not in data */
},
"required": ["bar"]
},
{
"properties": {
"foo": {"type": "string"}
},
"required": ["foo"]
}
]
},
"tests": [
{
"description": "first oneOf valid (complex)",
"data": {"bar": 2},
"valid": true
},
{
"description": "second oneOf valid (complex)",
"data": {"foo": "baz"},
"valid": true
},
{
"description": "both oneOf valid (complex)",
"data": {"foo": "baz", "bar": 2},
"valid": false
},
{
"description": "neither oneOf valid (complex)",
"data": {"foo": 2, "bar": "quux"},
"valid": false
}
]
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (10 by maintainers)
Commits related to this issue
- issue #307 - test that oneOf handles missing optional property — committed to aznan2/JSON-Schema-Test-Suite by deleted user 5 years ago
- issue #307 - removed pound sign from description — committed to aznan2/JSON-Schema-Test-Suite by deleted user 5 years ago
- issue #307 - removed issue reference from description — committed to aznan2/JSON-Schema-Test-Suite by deleted user 5 years ago
- issue #307 - made test compatible with draft4 — committed to aznan2/JSON-Schema-Test-Suite by deleted user 5 years ago
- Merge pull request #308 from aznan2/master issue #307 - test that oneOf handles missing optional property — committed to json-schema-org/JSON-Schema-Test-Suite by Julian 5 years ago
@aznan2 Julian said what I was trying to allude to. The location of a subschema should not change the validation result of that subschema by itself. The combination of an array of subschema validation results should be collected and modified by the encasing applicator keyword, if any, such as
*Of
andnot
for example.