I want to perform JSON validation on my schema, which has four properties:
group
partition
select
features
If using either group
or partition
, then features
is required. If using select
, then features
is prohibited. (Note that this seems to be a different case than in this question - I don't want to make features
'not required', but make it so if you include it, it's a validation error.
So my three options are:
group
ANDfeatures
partition
ANDfeatures
select
AND NOTfeatures
I've encoded these as:
"oneOf": [
{ "required": [ "group", "features" ] },
{ "required": [ "partition", "features" ] },
{ "required": [ "select" ] }
]
But I can't figure out how to appropriately force features
to be excluded from the last option - or is this even a possibility?