A relatively new addition to JSON Schema (draft-07) adds the if, then and else keywords. I cannot work out how to use these new key words correctly. Here is my JSON Schema s
Can't you just use the "else" property ?
{ "type": "object", "properties": { "foo": { "type": "string" }, "bar": { "type": "string" } }, "if": { "properties": { "foo": { "enum": ["bar"] } } }, "then": { "required": ["bar"] }, "else": { "required": [] } }