-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
If you have a schem with a valid type and also oneOf anyOf, allOf or noneOf, then defaults are not applied.
A typical use case is when you have an object schema that is required to have one field or another, but not both, (see https://stackoverflow.com/questions/24023536/json-schema-how-do-i-require-one-field-or-another-or-one-of-two-others-but-no). You can do this kind of thing with the following type of schema schema :
{
"title": "test",
"type": "object",
"properties": {
"obj1": {
"type": "object",
"properties": {
"prop1": {
"type": "string",
"default": "val1"
}
}
},
"obj2": {
"type": "object",
"properties": {
"prop2": {
"type": "string",
"default": "val2"
}
}
}
},
"oneOf": [
{
"required": [
"obj1"
]
},
{
"required": [
"obj2"
]
}
]
}
However, conflate does not apply the object property defaults in the case of json input data such as :
{
"obj1": {}
}
Conflate should output :
{
"obj1": {
"prop1": "val1"
}
}
Metadata
Metadata
Assignees
Labels
No labels