From 136859ca6da6350853040b01f9a4bb3af09689df Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Mon, 14 Feb 2022 11:06:20 +0100 Subject: specify full schema URL in instances --- src/hydrilla/builder/build.py | 8 ++++++-- src/hydrilla/schemas | 2 +- src/test/source-package-example | 2 +- src/test/test_hydrilla_builder.py | 8 ++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/hydrilla/builder/build.py b/src/hydrilla/builder/build.py index 8e10776..58fe1b2 100644 --- a/src/hydrilla/builder/build.py +++ b/src/hydrilla/builder/build.py @@ -43,6 +43,8 @@ _ = util.translation(here / 'locales').gettext index_validator = util.validator_for('package_source-1.schema.json') +schemas_root = 'https://hydrilla.koszko.org/schemas' + generated_by = { 'name': 'hydrilla.builder', 'version': _version.version @@ -284,7 +286,7 @@ class Build: new_item_obj.update([(p, item_def[p]) for p in copy_props]) new_item_obj['version'] = util.normalize_version(item_def['version']) - new_item_obj['api_schema_version'] = [1] + new_item_obj['$schema'] = f'{schemas_root}/api_{item_def["type"]}_description-1.schema.json' new_item_obj['source_copyright'] = self.copyright_file_refs new_item_obj['source_name'] = self.source_name new_item_obj['generated_by'] = generated_by @@ -303,6 +305,8 @@ class Build: """ index_validator.validate(index_obj) + schema = f'{schemas_root}/api_source_description-1.schema.json' + self.source_name = index_obj['source_name'] generate_spdx = index_obj.get('reuse_generate_spdx_report', False) @@ -334,7 +338,7 @@ class Build: } self.source_description = { - 'api_schema_version': [1], + '$schema': schema, 'source_name': self.source_name, 'source_copyright': self.copyright_file_refs, 'upstream_url': index_obj['upstream_url'], diff --git a/src/hydrilla/schemas b/src/hydrilla/schemas index b191710..1d1c93d 160000 --- a/src/hydrilla/schemas +++ b/src/hydrilla/schemas @@ -1 +1 @@ -Subproject commit b19171081e23bcccf9b41588c0464ca9c2c657c0 +Subproject commit 1d1c93d5a9011ecdf58a4952afcb5a1faff30e76 diff --git a/src/test/source-package-example b/src/test/source-package-example index 26c4622..48606f2 160000 --- a/src/test/source-package-example +++ b/src/test/source-package-example @@ -1 +1 @@ -Subproject commit 26c4622417cb786825b1b18083adfe5ce44b2756 +Subproject commit 48606f288c89aaadb28a021ab71945e1e87fd14e diff --git a/src/test/test_hydrilla_builder.py b/src/test/test_hydrilla_builder.py index 26ede09..c8d29f1 100644 --- a/src/test/test_hydrilla_builder.py +++ b/src/test/test_hydrilla_builder.py @@ -62,7 +62,7 @@ class CaseSettings: self.contents = default_contents.copy() self.expected_resources = [{ - 'api_schema_version': [1], + '$schema': 'https://hydrilla.koszko.org/schemas/api_resource_description-1.schema.json', 'source_name': 'hello', 'source_copyright': [{ 'file': 'report.spdx', @@ -88,7 +88,7 @@ class CaseSettings: }], 'generated_by': expected_generated_by }, { - 'api_schema_version': [1], + '$schema': 'https://hydrilla.koszko.org/schemas/api_resource_description-1.schema.json', 'source_name': 'hello', 'source_copyright': [{ 'file': 'report.spdx', @@ -112,7 +112,7 @@ class CaseSettings: 'generated_by': expected_generated_by }] self.expected_mapping = { - 'api_schema_version': [1], + '$schema': 'https://hydrilla.koszko.org/schemas/api_mapping_description-1.schema.json', 'source_name': 'hello', 'source_copyright': [{ 'file': 'report.spdx', @@ -138,7 +138,7 @@ class CaseSettings: 'generated_by': expected_generated_by } self.expected_source_description = { - 'api_schema_version': [1], + '$schema': 'https://hydrilla.koszko.org/schemas/api_source_description-1.schema.json', 'source_name': 'hello', 'source_copyright': [{ 'file': 'report.spdx', -- cgit v1.2.3