diff --git a/docs/requirements.txt b/docs/requirements.txt index 044449040..9a81cc89c 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,5 @@ # For generating documentation. -Sphinx +Sphinx < 7 sphinx-rtd-theme # documentation theme sphinx_autodoc_typehints == 1.21.3 nbsphinx diff --git a/pulser-core/pulser/json/abstract_repr/validation.py b/pulser-core/pulser/json/abstract_repr/validation.py index 09bd7f062..9b8cd7ec0 100644 --- a/pulser-core/pulser/json/abstract_repr/validation.py +++ b/pulser-core/pulser/json/abstract_repr/validation.py @@ -16,12 +16,12 @@ from typing import Literal import jsonschema +from referencing import Registry, Resource -from pulser.json.abstract_repr import SCHEMAS, SCHEMAS_PATH +from pulser.json.abstract_repr import SCHEMAS -RESOLVER = jsonschema.validators.RefResolver( - base_uri=f"{SCHEMAS_PATH.resolve().as_uri()}/", - referrer=SCHEMAS["sequence"], +REGISTRY: Registry = Registry().with_resources( + [("device-schema.json", Resource.from_contents(SCHEMAS["device"]))] ) @@ -37,5 +37,5 @@ def validate_abstract_repr( obj = json.loads(obj_str) validate_args = dict(instance=obj, schema=SCHEMAS[name]) if name == "sequence": - validate_args["resolver"] = RESOLVER + validate_args["registry"] = REGISTRY jsonschema.validate(**validate_args) diff --git a/pulser-core/requirements.txt b/pulser-core/requirements.txt index 40cee3bfc..69fa4291c 100644 --- a/pulser-core/requirements.txt +++ b/pulser-core/requirements.txt @@ -1,4 +1,4 @@ -jsonschema < 4.18 +jsonschema >= 4.18 matplotlib # Numpy 1.20 introduces type hints, 1.24.0 breaks matplotlib < 3.6.1 numpy >= 1.20, != 1.24.0 diff --git a/tests/test_abstract_repr.py b/tests/test_abstract_repr.py index 2d83ce41b..3558c7051 100644 --- a/tests/test_abstract_repr.py +++ b/tests/test_abstract_repr.py @@ -38,7 +38,7 @@ AbstractReprEncoder, abstract_repr, ) -from pulser.json.abstract_repr.validation import RESOLVER +from pulser.json.abstract_repr.validation import REGISTRY from pulser.json.exceptions import AbstractReprError, DeserializeDeviceError from pulser.parametrized.decorators import parametrize from pulser.parametrized.paramobj import ParamObj @@ -282,7 +282,7 @@ def validate_schema(instance): "pulser-core/pulser/json/abstract_repr/schemas/" "sequence-schema.json" ) as f: schema = json.load(f) - jsonschema.validate(instance=instance, schema=schema, resolver=RESOLVER) + jsonschema.validate(instance=instance, schema=schema, registry=REGISTRY) class TestSerialization: