From 80f2a5d52b4bc1c8eaf92b90b3ab2467189271a5 Mon Sep 17 00:00:00 2001 From: Stefan Binder Date: Fri, 27 Jan 2023 18:26:21 +0000 Subject: [PATCH 1/3] Fix incompatibility with jsonschema < 4.17 --- altair/utils/schemapi.py | 7 ++++--- tools/schemapi/schemapi.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/altair/utils/schemapi.py b/altair/utils/schemapi.py index f170acd3f..d3e1aef82 100644 --- a/altair/utils/schemapi.py +++ b/altair/utils/schemapi.py @@ -50,9 +50,10 @@ def validate_jsonschema(spec, schema, resolver=None): # e.g. '#/definitions/ValueDefWithCondition' would be a valid $ref in a Vega-Lite schema but # it is not a valid URI reference due to the characters such as '<'. - validator = JSONSCHEMA_VALIDATOR( - schema, format_checker=JSONSCHEMA_VALIDATOR.FORMAT_CHECKER, resolver=resolver - ) + validator_kwargs = {"resolver": resolver} + if hasattr(JSONSCHEMA_VALIDATOR, "FORMAT_CHECKER"): + validator_kwargs["format_checker"] = JSONSCHEMA_VALIDATOR.FORMAT_CHECKER + validator = JSONSCHEMA_VALIDATOR(schema, **validator_kwargs) error = jsonschema.exceptions.best_match(validator.iter_errors(spec)) if error is not None: raise error diff --git a/tools/schemapi/schemapi.py b/tools/schemapi/schemapi.py index 3844483a7..4949ba7f8 100644 --- a/tools/schemapi/schemapi.py +++ b/tools/schemapi/schemapi.py @@ -48,9 +48,10 @@ def validate_jsonschema(spec, schema, resolver=None): # e.g. '#/definitions/ValueDefWithCondition' would be a valid $ref in a Vega-Lite schema but # it is not a valid URI reference due to the characters such as '<'. - validator = JSONSCHEMA_VALIDATOR( - schema, format_checker=JSONSCHEMA_VALIDATOR.FORMAT_CHECKER, resolver=resolver - ) + validator_kwargs = {"resolver": resolver} + if hasattr(JSONSCHEMA_VALIDATOR, "FORMAT_CHECKER"): + validator_kwargs["format_checker"] = JSONSCHEMA_VALIDATOR.FORMAT_CHECKER + validator = JSONSCHEMA_VALIDATOR(schema, **validator_kwargs) error = jsonschema.exceptions.best_match(validator.iter_errors(spec)) if error is not None: raise error From 3706e90aabeb8255db45cc5bbe38b643205bad57 Mon Sep 17 00:00:00 2001 From: Stefan Binder Date: Fri, 27 Jan 2023 18:34:37 +0000 Subject: [PATCH 2/3] Add changelog entry for 4.2.2 --- doc/releases/changes.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/releases/changes.rst b/doc/releases/changes.rst index bdcf44b31..3c859c7ff 100644 --- a/doc/releases/changes.rst +++ b/doc/releases/changes.rst @@ -3,6 +3,13 @@ Altair Change Log ================= +Version 4.2.2 (released XXX YY, 2023) +------------------------------------- + +Bug Fixes +~~~~~~~~~ +- Fix incompatibility with jsonschema < 4.17 which got introduced in Altair 4.2.1 (#2860). + Version 4.2.1 (released Jan 26, 2023) ------------------------------------- From 932dc711d51507e3f7df7ed71cb1057a54508aa1 Mon Sep 17 00:00:00 2001 From: Stefan Binder Date: Fri, 27 Jan 2023 19:12:11 +0000 Subject: [PATCH 3/3] Fix jsonschema version in changelog --- doc/releases/changes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/releases/changes.rst b/doc/releases/changes.rst index 3c859c7ff..a2598b2b3 100644 --- a/doc/releases/changes.rst +++ b/doc/releases/changes.rst @@ -8,7 +8,7 @@ Version 4.2.2 (released XXX YY, 2023) Bug Fixes ~~~~~~~~~ -- Fix incompatibility with jsonschema < 4.17 which got introduced in Altair 4.2.1 (#2860). +- Fix incompatibility with jsonschema < 4.5 which got introduced in Altair 4.2.1 (#2860). Version 4.2.1 (released Jan 26, 2023) -------------------------------------