55
66import networkx as nx
77import graphviz
8- from jsonschema import RefResolver , Draft202012Validator
8+ from jsonschema import Draft202012Validator
9+ from referencing import Registry , Resource
10+ from referencing .jsonschema import DRAFT202012
911import yaml
1012
1113import sophios
@@ -680,7 +682,6 @@ def get_validator(tools_cwl: Tools, yml_stems: List[str], schema_store: Dict[str
680682
681683 schema = wic_main_schema (tools_cwl , yml_stems , schema_store , hypothesis )
682684 schema_store [schema ['$id' ]] = schema
683- schema_store ['wic_tag' ] = wic_tag_schema (hypothesis )
684685 if write_to_disk :
685686 with open ('autogenerated/schemas/wic.json' , mode = 'w' , encoding = 'utf-8' ) as f :
686687 f .write (json .dumps (schema , indent = 2 ))
@@ -696,7 +697,11 @@ def get_validator(tools_cwl: Tools, yml_stems: List[str], schema_store: Dict[str
696697 # The $ref tag refers to URIs defined in $id tags, NOT relative paths on
697698 # the local filesystem! We need to create a global mapping between ids and schemas
698699 # i.e. schema_store.
699- resolver = RefResolver .from_schema (schema , store = schema_store )
700+ schema_store_resource : Resource = Resource (contents = schema_store , specification = DRAFT202012 ) # type: ignore
701+ registry : Registry = Registry ().with_resource (uri = "wic_schema_store" , resource = schema_store_resource )
702+ wic_tag_schema_resource : Resource = Resource (contents = wic_tag_schema (
703+ hypothesis ), specification = DRAFT202012 ) # type: ignore
704+ registry = registry .with_resource (uri = "wic_tag" , resource = wic_tag_schema_resource )
700705 """ Use check_schema to 'first verify that the provided schema is
701706 itself valid, since not doing so can lead to less obvious error
702707 messages and fail in less obvious or consistent ways.'
@@ -707,5 +712,5 @@ def get_validator(tools_cwl: Tools, yml_stems: List[str], schema_store: Dict[str
707712 # try temporarily commenting this line out to generate the schema anyway.
708713 # Then, in any yml file, the very first line should show a "schema stack trace"
709714 Draft202012Validator .check_schema (schema )
710- validator = Draft202012Validator (schema , resolver = resolver )
715+ validator = Draft202012Validator (schema , registry = registry )
711716 return validator
0 commit comments