JSON模式:值是对象属性之一

时间:2019-04-27 01:19:55

标签: json jsonschema

JSON Schema是否可以将值限制为对象属性之一?

{ "states": { "ok" : {...}, "fail" : {...} }, "initial": "ok" }

理想情况是:

"properties" : {
  "states": {
    "type": "object",
    "additionalProperties": ...
  },
  "initial": {
    "type": "string",
    "enum": { "keys": "states" }
  }
}

0 个答案:

没有答案