diff --git a/.changes/unreleased/Dependencies-20230927-234903.yaml b/.changes/unreleased/Dependencies-20230927-234903.yaml new file mode 100644 index 00000000..a888b782 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230927-234903.yaml @@ -0,0 +1,6 @@ +kind: Dependencies +body: Migrated jsonschema.RefResolver to referencing.Registry for jsonschema 4 compatibility +time: 2023-09-27T23:49:03.729376567-04:00 +custom: + Author: 'codecae' + PR: "160" diff --git a/dbt_semantic_interfaces/parsing/schemas.py b/dbt_semantic_interfaces/parsing/schemas.py index 7c150136..0216e4aa 100644 --- a/dbt_semantic_interfaces/parsing/schemas.py +++ b/dbt_semantic_interfaces/parsing/schemas.py @@ -1,4 +1,7 @@ -from jsonschema import RefResolver +from typing import List, Tuple + +from referencing import Registry, Resource +from referencing.jsonschema import DRAFT7 from dbt_semantic_interfaces.parsing.schema_validator import SchemaValidator @@ -315,8 +318,8 @@ time_spine_table_configuration_schema["$id"]: time_spine_table_configuration_schema, } - -resolver = RefResolver.from_schema(schema=metric_schema, store=schema_store) -semantic_model_validator = SchemaValidator(semantic_model_schema, resolver=resolver) -metric_validator = SchemaValidator(metric_schema, resolver=resolver) -project_configuration_validator = SchemaValidator(project_configuration_schema, resolver=resolver) +resources: List[Tuple[str, Resource]] = [(str(k), DRAFT7.create_resource(v)) for k, v in schema_store.items()] +registry: Registry = Registry().with_resources(resources) +semantic_model_validator = SchemaValidator(semantic_model_schema, registry=registry) +metric_validator = SchemaValidator(metric_schema, registry=registry) +project_configuration_validator = SchemaValidator(project_configuration_schema, registry=registry) diff --git a/pyproject.toml b/pyproject.toml index 658d4f63..1fef0419 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ classifiers = [ ] dependencies = [ "pydantic~=1.10", - "jsonschema~=3.0", + "jsonschema~=4.0", "PyYAML~=6.0", "more-itertools~=8.0", "Jinja2~=3.0",