我知道我可以执行以下操作(来自http://spacetelescope.github.io/understanding-json-schema/reference/object.html#schema-dependencies)
{
"type": "object",
"properties": {
"name": { "type": "string" },
"credit_card": { "type": "integer" }
},
"dependencies": {
"credit_card": {
"properties": {
"billing_address": { "type": "string" }
},
"required": ["billing_address"]
}
}
}
但是在我的情况下,当信用卡具有特定价值时,我只希望信用卡依赖于所需的帐单地址。这是我的尝试不起作用:
{
"type": "object",
"properties": {
"name": { "type": "string" },
"credit_card": { "type": "integer" },
"billing_address": { "type": "string" }
},
"dependencies": {
"credit_card": {
"enum": [100000000000],
"properties": {
"billing_address": {}
},
"required": ["billing_address"]
}
}
}
我正在反对v4草案。