What I want is:
If check_this
is true then only_on_condition
should match ^zzzz
This schema is not working:
{
"type": "array",
"items": {
"type": "object",
"properties": {
"one": {
"type": "string"
},
"only_on_condition": {
"type": "string"
},
"my_obj": {
"type": ["null", "object"]
}
},
"if": {
"properties": {
"my_obj": {
"properties": {
"my_obj_one": {
"properties": {
"check_this": {
"const": "true"
}
}
}
}
}
}
},
"then": {
"properties": {
"only_on_condition": {
"pattern": "^zzzz"
}
}
}
}
}
Using that schema if I leave out the check_this
property it runs the then
rule every time. I want check_this
to be optional so I can’t mark it required:
[
{
"one": "test",
"only_on_condition": "test",
"my_obj": {
"my_obj_one": {}
},
"my_list": [
"sdfsdf"
]
}
]
But even if I do specify check_this
it doesn’t apply the then rule at all even if it is true:
[
{
"one": "test",
"only_on_condition": "test",
"my_obj": {
"my_obj_one": {
"check_this": {
"const": "true" # passes if true or false
}
}
},
"my_list": [
"sdfsdf"
]
}
]