diff --git a/.changes/unreleased/Dependencies-20230927-234903.yaml b/.changes/unreleased/Dependencies-20230927-234903.yaml new file mode 100644 index 00000000..ede0ab54 --- /dev/null +++ b/.changes/unreleased/Dependencies-20230927-234903.yaml @@ -0,0 +1,6 @@ +kind: Dependencies +body: Migrated jsonschema.RefResolver to referncing.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 935d6617..bfd7714b 100644 --- a/dbt_semantic_interfaces/parsing/schemas.py +++ b/dbt_semantic_interfaces/parsing/schemas.py @@ -1,4 +1,5 @@ -from jsonschema import RefResolver +from referencing import Registry +from referencing.jsonschema import DRAFT7 from dbt_semantic_interfaces.parsing.schema_validator import SchemaValidator @@ -337,9 +338,9 @@ 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) -saved_query_validator = SchemaValidator(saved_query_schema, resolver=resolver) +resources=[(k,DRAFT7.create_resource(v)) for k,v in schema_store.items()] +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) +saved_query_validator = SchemaValidator(saved_query_schema, registry=registry) diff --git a/pyproject.toml b/pyproject.toml index 4ce38a1a..992d6506 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",