是否可以在模式中验证空值,例如[属性A为空值,那么将有一些必填字段]
例如:
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "college.json#",
"title": "student",
"description": "syidentdetails",
"type": "object",
"properties": {
"colleges": {
"type": "array"
},
"school": {
"type": "array"
},
"if":{
"properties":{
"college":["type":null]
}
},"then":{["required":"school"]}
}
您需要用引号定义类型值,而不是实际的null
。
"type": "null"