我想验证JSON以使两个字段中的一个变为manadatory.
假设我们有两个字段(电子邮件地址和电话号码).我想确保记录有效需要两个字段之一.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "ExampleID-0212",
"title": "objectExamples",
"description": "Demo",
"type": "object",
"properties": {
"RecordObject": {
"type": "object",
"properties": {
"emailAddress": {
"type": "string"
},
"PhoneNumber": {
"type": "number"
}
}
}
},
"required": [
"RecordObject"
]
}
Run Code Online (Sandbox Code Playgroud)