Please refer to this question for the introduction Two way binding dependences based on enum value in json schema.
Now the case is that if I pass userType = CUSTOMER
then it doesn't accept the request and in also the case of userType = customer
.
Can anyone suggest me JSON schema solution for this?
There isn't a way to do this that isn't awful, but the least awful thing I can think of is to use pattern
with a regex that includes both cases.
{
"type": "string",
"anyOf": [
{ "title": "Customer", "pattern": "[Cc][Uu][Ss][Tt][Oo][Mm][Ee][Rr]" },
{ "title": "Admin", "pattern": "[Aa][Dd][Mm][Ii][Nn]" },
]
}
(The title
isn't necessary, it's just a nicety for the poor dev who has to read this schema)