Skip to content

Commit

Permalink
feat: migrated jsonschema.RefResolver to referencing.Registry
Browse files Browse the repository at this point in the history
  • Loading branch information
codecae committed Sep 28, 2023
1 parent 760101e commit 1eb3294
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Dependencies-20230927-234903.yaml
Original file line number Diff line number Diff line change
@@ -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"
15 changes: 8 additions & 7 deletions dbt_semantic_interfaces/parsing/schemas.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 1eb3294

Please sign in to comment.