Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incompatibility with jsonschema < 4.5 #2860

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions altair/utils/schemapi.py
Expand Up @@ -50,9 +50,10 @@ def validate_jsonschema(spec, schema, resolver=None):
# e.g. '#/definitions/ValueDefWithCondition<MarkPropFieldOrDatumDef,
# (Gradient|string|null)>' 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
Expand Down
7 changes: 7 additions & 0 deletions doc/releases/changes.rst
Expand Up @@ -3,6 +3,13 @@
Altair Change Log
=================

Version 4.2.2 (released XXX YY, 2023)
-------------------------------------

Bug Fixes
~~~~~~~~~
- Fix incompatibility with jsonschema < 4.5 which got introduced in Altair 4.2.1 (#2860).

Version 4.2.1 (released Jan 26, 2023)
-------------------------------------

Expand Down
7 changes: 4 additions & 3 deletions tools/schemapi/schemapi.py
Expand Up @@ -48,9 +48,10 @@ def validate_jsonschema(spec, schema, resolver=None):
# e.g. '#/definitions/ValueDefWithCondition<MarkPropFieldOrDatumDef,
# (Gradient|string|null)>' 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
Expand Down