I want to add conditionally required based on value of some other property. 'companyName' and 'companyAddress' should be required only if 'isInexperienced' value is false.
Schema
{
"type": "object",
"properties": {
"previous_employment_section": {
"type": "array",
"items": {
"type": "object",
"properties": {
"companyAddress": {
"type": "string"
},
"companyName": {
"type": "string"
}
},
"if": {
"#/properties/isInexperienced": {
"const": false
}
},
"then": {
"required": [
"companyName",
"companyAddress"
]
}
}
},
"isInexperienced": {
"type": "boolean"
}
}
}
Data
{
"previous_employment_section": [],
"isInexperienced": true
}