From 7cb15e352e89da140a08acbda83bf9492a75f36a Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Fri, 15 Nov 2024 12:12:16 -0600 Subject: [PATCH] safe point 1 --- .../_yaml_conversion_specification.py | 17 +++++------------ .../test_yaml_conversion_specification.py | 7 +------ 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/neuroconv/tools/yaml_conversion_specification/_yaml_conversion_specification.py b/src/neuroconv/tools/yaml_conversion_specification/_yaml_conversion_specification.py index 827a6c8bd..244cd5013 100644 --- a/src/neuroconv/tools/yaml_conversion_specification/_yaml_conversion_specification.py +++ b/src/neuroconv/tools/yaml_conversion_specification/_yaml_conversion_specification.py @@ -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, diff --git a/tests/test_on_data/test_yaml/test_yaml_conversion_specification.py b/tests/test_on_data/test_yaml/test_yaml_conversion_specification.py index 251e081ee..93d9f0f56 100644 --- a/tests/test_on_data/test_yaml/test_yaml_conversion_specification.py +++ b/tests/test_on_data/test_yaml/test_yaml_conversion_specification.py @@ -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(