diff --git a/asdf_pydantic/schema.py b/asdf_pydantic/schema.py index 2adc6ab..38a2821 100644 --- a/asdf_pydantic/schema.py +++ b/asdf_pydantic/schema.py @@ -12,7 +12,7 @@ "allOf", "anyOf", "required", - "$defs", + "definitions", ) @@ -45,6 +45,10 @@ def generate(self, schema, mode="validation"): json_schema["$schema"] = self.schema_dialect json_schema["id"] = f"{self.tag_uri}/schema" + # TODO: Convert jsonschema 2020-12 to ASDF schema + if "$defs" in json_schema: + json_schema["definitions"] = json_schema.pop("$defs") + # Order keys json_schema = { **{ @@ -55,5 +59,4 @@ def generate(self, schema, mode="validation"): **json_schema, # Rest of the keys not in order list } - # TODO: Convert jsonschema 2020-12 to ASDF schema return json_schema diff --git a/tests/examples/test_node.py b/tests/examples/test_node.py index 8959b4b..6c248d0 100644 --- a/tests/examples/test_node.py +++ b/tests/examples/test_node.py @@ -107,7 +107,7 @@ def test_errors_reading_invalid_asdf_file(tmp_path): software: !core/software-1.0.0 {name: asdf, version: 3.4.0} - !core/extension_metadata-1.0.0 {extension_class: tests.examples.test_node.setup_module..TestExtension, extension_uri: 'asdf://asdf-pydantic/examples/extensions/test-1.0.0'} - root: ! + root: ! name: foo child: 1 ...