Answer the question
In order to leave comments, you need to log in
How to correctly display JSON schema validation errors for the anyOf key?
There is a JSON schema with the following fragment:
{
"required": [
"label",
"resource_type",
"category"
],
"properties": {
...
},
"anyOf": [
{
"properties": {
"resource_type": { "enum": ["phone"] },
"phone": {
"minLength": 1
}
},
"required": ["phone"]
},
{
"properties": {
"resource_type": {
"enum": [
"audio", "pdf", "url", "video"
]
},
"url": {
"minLength": 1
}
},
"required": ["url"]
},
{
"properties": {
"resource_type": { "enum": ["html"] },
"html_content": {
"minLength": 1
}
},
"required": ["html_content"]
},
{
"properties": {
"resource_type": { "enum": ["media_resource"] },
"media_resource_uuid": {
"minLength": 1
}
},
"required": ["media_resource_uuid"]
}
]
}
}
{
"label" : "Test label",
"phone" : "112",
"resource_type" : "phone",
"description" : "Test desc",
"category" : "Test category"
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question