【发布时间】:2020-10-08 07:59:34
【问题描述】:
我想根据 ordertype 的值验证销售日期和客户可用性。(注意,它们不在同一个对象下)。有没有办法根据根值验证子值?
{
"type": "object",
"properties": {
"Order": {
"type": "object",
"properties": {
"OrderDetails": {
"type": "object",
"properties": {
"OrderType": {
"type": "string",
"enum": [
"Y",
"N"
]
}
}
}
}
},
"Sale": {
"type": "object",
"properties": {
"Saledate": {
"format": "date"/*should be present when OrderType is Y*/
}
}
},
"Customer": {
"type": "object",
"properties": {
"Avilability": {
"type": "string",
"enum": [
"Y",
"N"
]/*should be present when orderType is Y*/
}
}
}
}
}
【问题讨论】:
标签: json jsonschema json-schema-validator