Skip to content

UnknownType errors encountered during validation look a bit ugly #373

Closed
@Julian

Description

@Julian
⊙  ~[jsonschema:python] -c 'from jsonschema import Draft4Validator; Draft4Validator({"type": "flooglekins"}).validate("foo")'                                                                                                                                                                                                                                   Julian@home
Traceback (most recent call last):
  File "<module>", line 1, in <module>
  File "jsonschema/validators.py", line 134, in validate
    for error in self.iter_errors(*args, **kwargs):
  File "jsonschema/validators.py", line 110, in iter_errors
    for error in errors:
  File "jsonschema/_validators.py", line 290, in type_draft4
    if not any(validator.is_type(instance, type) for type in types):
  File "jsonschema/_validators.py", line 290, in <genexpr>
    if not any(validator.is_type(instance, type) for type in types):
  File "jsonschema/validators.py", line 139, in is_type
    raise UnknownType(type, instance, self.schema)
UnknownType:
Unknown type 'flooglekins' for validator with schema:
    {'type': 'flooglekins'}

While checking instance:
    'foo'

(This schema is invalid, but would like to clean up the empty extra line there).

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething doesn't work the way it should.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions