draft-07 的 enum
属性定义为:
"enum": {
"type": "array",
"items": true,
"minItems": 1,
"uniqueItems": true
},
但是在 SPEC没有 true
值的定义:
The value of "items" MUST be either a valid JSON Schema or an array of valid JSON Schemas.
请将我链接到 SPEC 定义验证器在满足 true
代替 schema
时的行为的点
最佳答案
http://json-schema.org/latest/json-schema-core.html#rfc.section.4.3.1
The boolean schema values "true" and "false" are trivial assertions that always return themselves regardless of the instance value. As an example, in terms of the validation vocabulary, boolean schemas are equivalent to the following behaviors:
true
- Always passes validation, as if the empty schema {}
false
- Always fails validation, as if the schema { "not":{} }
关于jsonschema - `true` 的 `schema` 值的定义行为在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49833963/