diff --git a/src/sophios/schemas/wic_schema.py b/src/sophios/schemas/wic_schema.py index 48b35260..e4dcd551 100644 --- a/src/sophios/schemas/wic_schema.py +++ b/src/sophios/schemas/wic_schema.py @@ -7,6 +7,7 @@ import graphviz from jsonschema import Draft202012Validator from referencing import Registry, Resource +from referencing.jsonschema import DRAFT202012 import yaml import sophios @@ -681,7 +682,6 @@ def get_validator(tools_cwl: Tools, yml_stems: List[str], schema_store: Dict[str schema = wic_main_schema(tools_cwl, yml_stems, schema_store, hypothesis) schema_store[schema['$id']] = schema - schema_store['wic_tag'] = wic_tag_schema(hypothesis) if write_to_disk: with open('autogenerated/schemas/wic.json', mode='w', encoding='utf-8') as f: f.write(json.dumps(schema, indent=2)) @@ -697,9 +697,11 @@ def get_validator(tools_cwl: Tools, yml_stems: List[str], schema_store: Dict[str # The $ref tag refers to URIs defined in $id tags, NOT relative paths on # the local filesystem! We need to create a global mapping between ids and schemas # i.e. schema_store. - resource: Resource = Resource.from_contents(schema_store) - initial_registry: Registry = Registry() - registry: Registry = resource @ initial_registry + schema_store_resource: Resource = Resource(contents=schema_store, specification=DRAFT202012) # type: ignore + registry: Registry = Registry().with_resource(uri="wic_schema_store", resource=schema_store_resource) + wic_tag_schema_resource: Resource = Resource(contents=wic_tag_schema( + hypothesis), specification=DRAFT202012) # type: ignore + registry = registry.with_resource(uri="wic_tag", resource=wic_tag_schema_resource) """ Use check_schema to 'first verify that the provided schema is itself valid, since not doing so can lead to less obvious error messages and fail in less obvious or consistent ways.'