Skip to content

schema with error can be used for validation #399

Closed
@ghost

Description

Schema with mistake loads without throwing any error, and errors doesn't get recognized untils there's an instance being validated against it.

schema = {
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "required": [
    "foo"
  ],
  "properties": {
    "foo": {
      "$ref": "#/definitions/FooFoo"
    }
  },
  "definitions": {
    "Foo": {
      "type": "object",
      "required": [
        "bar"
      ],
      "properties": {
        "bar": {
          "type": "string"
        }
      }
    }
  }
}

Draft4Validator(schema).validate({})  #Throws validation error
Draft4Validator(schema).validate({"foo": {"bar": "baz"}}) #Throws RefResolutionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions