I have a simple case that I am not able to understand how to do it.
I have 3 boolean controls, Parent, childA, childB.
If parent is true then at least one of the children must be true.
Below is my JSONForm schema and UI Schema and it can be tested in any online playground.
NOTE: if in the below JSON Schema I change then->anyOf to then->allOf then validation works perfectly but that’s not what I am trying to achieve.
Thanks a lot in advance for your time.
JSON Schema
{
"type": "object",
"properties": {
"parent": {
"type": "boolean"
},
"childA": {
"type": "boolean"
},
"childB": {
"type": "boolean"
}
},
"if": {
"properties": {
"parent": {
"const": true
}
}
},
"then": {
"required": [
"parent",
"childA",
"childB"
]
},
"else": {
"required": [
"parent"
]
},
"allOf": [
{
"if": {
"properties": {
"parent": {
"const": true
}
}
},
"then": {
"anyOf": [
{
"properties": {
"childA": {
"const": true
}
}
},
{
"properties": {
"childB": {
"const": true
}
}
}
]
}
}
]
}
UI Schema
{
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"label": "Parent",
"scope": "#/properties/parent"
},
{
"type": "Control",
"label": "Child A",
"scope": "#/properties/childA"
},
{
"type": "Control",
"label": "Child B",
"scope": "#/properties/childB"
}
]
}

