diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-02-14 11:06:20 +0100 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-02-14 11:06:20 +0100 |
commit | 136859ca6da6350853040b01f9a4bb3af09689df (patch) | |
tree | cd019ded44a6538cc53f7354579fea65c41d6f84 | |
parent | edbed9ce6912de60ab9b4f92c0d9d0a2c205136e (diff) | |
download | hydrilla-builder-136859ca6da6350853040b01f9a4bb3af09689df.tar.gz hydrilla-builder-136859ca6da6350853040b01f9a4bb3af09689df.zip |
specify full schema URL in instances
-rw-r--r-- | src/hydrilla/builder/build.py | 8 | ||||
m--------- | src/hydrilla/schemas | 0 | ||||
m--------- | src/test/source-package-example | 0 | ||||
-rw-r--r-- | src/test/test_hydrilla_builder.py | 8 |
4 files changed, 10 insertions, 6 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 -Subproject b19171081e23bcccf9b41588c0464ca9c2c657c +Subproject 1d1c93d5a9011ecdf58a4952afcb5a1faff30e7 diff --git a/src/test/source-package-example b/src/test/source-package-example -Subproject 26c4622417cb786825b1b18083adfe5ce44b275 +Subproject 48606f288c89aaadb28a021ab71945e1e87fd14 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', |