i have json like this
{ "user" : ["foo", "bar"] }
i want use if else here
if there "foo" in array user then field admin is required
I've tried it like this
{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "JSON Schema for role",
"type": "object",
"properties": {
"user": {
"type": ["array"],
"items" : {
"type" : "string",
"enum" : [
"foo",
"bar"
]
}
},
"admin" : {"type" : "string"},
"if": {
"properties": {
"user": { "const": "foo" }
},
"required": ["user"]
},
"then": { "required": ["admin"] }
},"additionalProperties": false}
but not work