Skip to content

Commit

Permalink
safe point 1
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin committed Nov 15, 2024
1 parent ad39789 commit 7cb15e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,13 @@ def run_conversion_from_yaml(
specification_schema = load_dict_from_file(file_path=schema_folder / "yaml_conversion_specification_schema.json")
metadata_schema = load_dict_from_file(file_path=schema_folder / "metadata_schema.json")

# Create registry and add schemas starting with the metadata schema
registry = Registry().with_resource(
"metadata_schema.json", Resource.from_contents(metadata_schema) # Base name without './'
# Create registry and add schemas
registry = (
Registry()
.with_resource("metadata_schema.json", Resource.from_contents(metadata_schema))
.with_resource("yaml_conversion_specification_schema.json", Resource.from_contents(specification_schema))
)

# Then add the specification schema with the metadata schema reference
registry = registry.with_resource(
"yaml_conversion_specification_schema.json", # This will be the base URI
Resource.from_contents(specification_schema),
)

# Also add with relative path since that's how it's referenced
registry = registry.with_resource("./metadata_schema.json", Resource.from_contents(metadata_schema))

# Validate using the registry
validate(
instance=specification,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ def test_validate_example_specifications(fname):
metadata_schema = load_dict_from_file(file_path=schema_folder / "metadata_schema.json")

# Create registry and add schemas
registry = (
Registry()
.with_resource("metadata_schema.json", Resource.from_contents(metadata_schema))
.with_resource("yaml_conversion_specification_schema.json", Resource.from_contents(specification_schema))
.with_resource("./metadata_schema.json", Resource.from_contents(metadata_schema))
)
registry = Registry().with_resource("metadata_schema.json", Resource.from_contents(metadata_schema))

yaml_file_path = path_to_test_yml_files / fname
validate(
Expand Down

0 comments on commit 7cb15e3

Please sign in to comment.