Hi,
I am trying to create a json schema. My requirement is that it should accept only "contactId" or ("firstName" and "lastName").
Here is my shcema:
{
"type": "object",
"properties": {
"contactId": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
}
},
"oneOf": [
{"required": ["contactId"]},
{"required": ["firstName"]},
{"required": ["lastName"]}
],
"additionalProperties": false
}
Valid input:
1.
{
"contactId": "385b1d9f-87fe-4f33-8672-ec365583138e"
}
2.
{
"city": "FirstName",
"state":"ssds"
}
Invalid Input:
{
"contactId": "385b1d9f-87fe-4f33-8672-ec365583138e",
"city": "FirstName",
"state":"ssds"
}
Any help?