diff options
author | Julian Berman <Julian@GrayVines.com> | 2021-06-27 01:28:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-27 01:28:28 -0400 |
commit | 0287da9b483b957e7d6ff385ec8ccb6de506c091 (patch) | |
tree | 4a523421ddcd0c5d3e219ed1c052dd491073d1b3 | |
parent | 96988024b4da608cad3b35df28571646e6e3b2f1 (diff) | |
parent | a0c3aae16572bada64c79d0a448190a27260098d (diff) | |
download | jsonschema-0287da9b483b957e7d6ff385ec8ccb6de506c091.tar.gz |
Merge pull request #819 from anexia-it/uri-template
Fixes validation for uri-template format
-rw-r--r-- | jsonschema/_format.py | 13 | ||||
-rw-r--r-- | setup.cfg | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/jsonschema/_format.py b/jsonschema/_format.py index 6d9be51..27eb4a9 100644 --- a/jsonschema/_format.py +++ b/jsonschema/_format.py @@ -412,18 +412,15 @@ else: try: - import uritemplate.exceptions + import uri_template except ImportError: pass else: @_checks_drafts( draft6="uri-template", draft7="uri-template", - raises=uritemplate.exceptions.InvalidTemplate, ) - def is_uri_template( - instance, - template_validator=uritemplate.Validator().force_balanced_braces(), - ): - template = uritemplate.URITemplate(instance) - return template_validator.validate(template) + def is_uri_template(instance): + if not isinstance(instance, str): + return True + return uri_template.validate(instance) @@ -38,6 +38,7 @@ format = rfc3987 strict-rfc3339 webcolors + uri_template format_nongpl = fqdn idna @@ -45,6 +46,7 @@ format_nongpl = webcolors rfc3986-validator>0.1.0 rfc3339-validator + uri_template [options.entry_points] console_scripts = |