是否可以在类似[属性 A 为 null 则存在一些必填字段]这样的模式中验证 null
例如:
"$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
。
“类型”:“空”
关于java - 检查 JSON 模式中是否为 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58235264/