jsonschema - `true` 的 `schema` 值的定义行为在哪里?

标签 jsonschema json-schema-validator

draft-07enum 属性定义为:

    "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/

相关文章:

c# - json.net Schema IsValid 慢

java - jsonschema2pojo maven插件不生成Java类

validation - 带有完美消息的 JSON 模式验证

json - 获取 json 验证失败的 json 文件的行号

arrays - 基于属性值的条件 Json 模式验证

java - String 类型的属性与以下类型不匹配 : object in schema JSON Schema validator

python - 尝试在 Python 中制作 JSON Schema 验证器以设置默认值

forms - 在react-jsonschema-form中带有必填字段的可选对象

json - 在 JsonSchema 中,格式值应设置为 "full-date"或 "date"?

java - jackson jsonSchema : How to set type object for property (JsonRawValue)