Closed
Description
Hello,
When mixing several objects with anyOf or oneOf, default values may be wrongly applied and interfere the validation.
Cf attached file for a simple use case that where used.
testSchemaValidator.zip
Here a first output example:
input value: {
"b": 2
}
schema: {
"anyOf": [
{
"required": [
"a"
],
"properties": {
"a": {
"type": "integer"
},
"aDefault": {
"type": "integer",
"default": 1
}
},
"type": "object",
"additionalProperties": false
},
{
"required": [
"b"
],
"properties": {
"b": {
"type": "integer"
},
"bDefault": {
"type": "integer",
"default": 2
}
},
"type": "object",
"additionalProperties": false
}
]
}
/aThe property a is required
The property b is not defined and the definition does not allow additional properties
The property aDefault is not defined and the definition does not allow additional properties
Failed to match at least one schema
output value: {
"b": 2,
"aDefault": 1,
"bDefault": 2
}
result should be valid and { "b": 2, "bDefault": 2}