【发布时间】:2017-06-08 10:23:05
【问题描述】:
我当前的 JSON 架构定义是这样的
{
"properties": {
"account_type": {
"description": "account type",
"enum": [
"CURRENT",
"SAVINGS",
"DEMAT"
],
"type": "string"
},
"demat_account_number": {
"description": "demat_account_number",
"type": "string"
}
},
"required": [
"account_type"
],
"type": "object"
}
我的要求是如果 "account_type" = "DEMAT" 那么 "demat_account_number" 应该成为必需的属性。
有什么方法可以实现这个验证吗?
【问题讨论】:
标签: json jsonschema json-schema-validator