【发布时间】:2019-10-03 17:07:28
【问题描述】:
是否可以根据 JSON 模式中的其他字段值使字段为必填/非必填?
JSON 架构包含 mode 字段。如果它等于 'release' 或 'debug',则不需要 file_path。如果它等于 'custom' 它是必需的。
"mode": {
"enum": [
"debug",
"release",
"custom"
],
"id": "mode",
"required": true,
"type": "string"
},
"file_path": {
"id": "file_path",
"required": false,
"type": "string"
}
【问题讨论】:
标签: json validation schema