diff options
author | Julian Berman <Julian@GrayVines.com> | 2021-08-18 18:15:07 +0100 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2021-08-18 18:15:07 +0100 |
commit | 00031cb043763842266877923552e40f0c8f36b5 (patch) | |
tree | a7ff84ca2244b7832f857f4715b324576ef3a604 /jsonschema/_legacy_validators.py | |
parent | eb633b216bad1acb1a7739279c5ab83bdd63d7a1 (diff) | |
download | jsonschema-00031cb043763842266877923552e40f0c8f36b5.tar.gz |
Remove types_msg which implements really old draft-3 behavior.
Since then, types aren't objects, they're just strings.
This just wastes time catching exceptions for newer drafts.
Diffstat (limited to 'jsonschema/_legacy_validators.py')
-rw-r--r-- | jsonschema/_legacy_validators.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/jsonschema/_legacy_validators.py b/jsonschema/_legacy_validators.py index 3a8b499..50fdbc8 100644 --- a/jsonschema/_legacy_validators.py +++ b/jsonschema/_legacy_validators.py @@ -193,8 +193,15 @@ def type_draft3(validator, types, instance, schema): if validator.is_type(instance, type): return else: + reprs = [] + for type in types: + try: + reprs.append(repr(type["name"])) + except Exception: + reprs.append(repr(type)) yield ValidationError( - _utils.types_msg(instance, types), context=all_errors, + f"{instance!r} is not of type {', '.join(reprs)}", + context=all_errors, ) |