I have a simple object like that:
{
"type": "object",
"properties": {
"channelName": {
"type": "string",
"enum": [
"channel_type_A",
"channel_type_B"
]
},
"channelDetails": {
"type": "object",
"oneOf": [
TYPE_A,
TYPE_B
]
}
}
}
TYPE_A and TYPE_B are two other irrelevant objects defined in the same file.
The point is that a json object like that:
{
"channelName" = "channel_type_A",
"channelDetails" = {TYPE_B}
}
is validated by the schema but I don't want to.
So, what I need is a schema that works like that:
- if "channelName" == "channel_type_A" -> "channelDetails" is TYPE_A
- if "channelName" == "channel_type_B" -> "channelDetails" is TYPE_B
I thought I could use dependencies, but I only saw examples that check if a property exists and don't make assumptions based on their values.
Is it possible to do what I want with json schema?