问题描述
我正在尝试验证对象的json模式。 但是如果没有为我的对象执行。 因此,在此示例中,我想检查销售服务为“ Y”时是否存在销售说明 (请注意,如果对象内部的对象是其他对象,我想执行),因为saleScheduling在Sale对象内部。
"Sale":{
"type":"object","properties":{
"SaleScheduling":{
"type":"object","properties":{
"SaleDescription":{
"type":"string"
},"SaleService":{
"type":"string","minLength":1,"enum":[
"Y","N"
]
}
},"if":{
"properties":{
"SaleService":{
"const":"Y" //if this is Y,SaleDescription should be present
}
}
},"then":{
"properties":{
"SaleDescription":{
"minLength":1
}
}
},"else":{
"properties":{
"SaleDescription":{
}
}
},"required":[
"SaleService"
]
}
},"required":[
"SaleScheduling"
]
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)