We have an involved use case which we have been trying to use dependencies for.
I'm not sure if this is the correct use. But here is the case.
We are trying to specify validation rules based on values. In this case is different combinations of values may be valid.
What I am trying to say by the oneOf is that one of these dependencies should be true.
I then have the following cases:
conditions:
1.If ID=B, and levelID=f, and nounID validates against regex (if nounID is 1000101 and either 1000102 or 1000103) and selected=true
2. If ID=B, and levelID=e then disallow monkeys
3.oneOf must be true (If ID=B, levelID=e1, nounID=1000101, selected=true), (If ID=B, levelID=e1, nounID=1000102, selected=true), (If ID=B, levelID=e1, nounID=1000103, selected=true)
{"appContext": {
"selected": {
"dependencies": {
"oneOf":[
{"allOf": [
{"ID": {"enum": ["B"]},
"levelID": {"enum": ["f"]},
"nounId": {"pattern": "1000101,(1000102|1000103)"},
"selected": {"enum": [true]}}]},
{"allOf": [
{"ID": {"enum": ["B"]},
"levelID": {"enum": ["e"]},
"disallow":[{"monkeys":{"type":"array"}}]}]},
{"oneOf": [
{"ID": {"enum": ["B"]},
"levelID": {"enum": ["e1"]},
"nounId": {"pattern": "1000101"},
"selected": {"enum": [true]}},
{"ID": {"enum": ["B"]},
"levelID": {"enum": ["e1"]},
"nounId": {"pattern": "1000102)"},
"selected": {"enum": [true]}},
{"ID": {"enum": ["B"]},
"levelID": {"enum": ["e1"]},
"nounId": {"pattern": "1000103)"},
"selected": {"enum": [true]}}]}]}}}}
Please let me know your comments on this approach.