From 9271ca7b8a8364423008ee400be541217b401c3c Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 1 Mar 2022 09:32:54 +0100 Subject: update schema versions to 1.0.1 --- src/hydrilla/builder/build.py | 6 +++--- src/hydrilla/schemas | 2 +- src/hydrilla/util/_util.py | 2 +- src/test/test_hydrilla_builder.py | 14 +++++++------- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/hydrilla/builder/build.py b/src/hydrilla/builder/build.py index 5a46259..1cf2ca8 100644 --- a/src/hydrilla/builder/build.py +++ b/src/hydrilla/builder/build.py @@ -44,7 +44,7 @@ here = Path(__file__).resolve().parent _ = util.translation(here / 'locales').gettext -index_validator = util.validator_for('package_source-1.schema.json') +index_validator = util.validator_for('package_source-1.0.1.schema.json') schemas_root = 'https://hydrilla.koszko.org/schemas' @@ -290,7 +290,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['$schema'] = f'{schemas_root}/api_{item_def["type"]}_description-1.schema.json' + new_item_obj['$schema'] = f'{schemas_root}/api_{item_def["type"]}_description-1.0.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 @@ -309,7 +309,7 @@ class Build: """ index_validator.validate(index_obj) - schema = f'{schemas_root}/api_source_description-1.schema.json' + schema = f'{schemas_root}/api_source_description-1.0.1.schema.json' self.source_name = index_obj['source_name'] diff --git a/src/hydrilla/schemas b/src/hydrilla/schemas index 5ef63e8..09634f3 160000 --- a/src/hydrilla/schemas +++ b/src/hydrilla/schemas @@ -1 +1 @@ -Subproject commit 5ef63e81ddd7299bfb738cae643bc48560b68a17 +Subproject commit 09634f3446866f712a022327683b1149d8f46bf0 diff --git a/src/hydrilla/util/_util.py b/src/hydrilla/util/_util.py index dc18fb9..778e78f 100644 --- a/src/hydrilla/util/_util.py +++ b/src/hydrilla/util/_util.py @@ -111,7 +111,7 @@ def version_string(ver: list[int], rev: Optional[int]=None) -> str: return '.'.join([str(n) for n in ver]) + ('' if rev is None else f'-{rev}') schemas = {} -for path in (here.parent / 'schemas').glob('*-1.schema.json'): +for path in (here.parent / 'schemas').glob('*-1.0.1.schema.json'): schema = json.loads(path.read_text()) schemas[schema['$id']] = schema diff --git a/src/test/test_hydrilla_builder.py b/src/test/test_hydrilla_builder.py index 5b11dd9..bee77a2 100644 --- a/src/test/test_hydrilla_builder.py +++ b/src/test/test_hydrilla_builder.py @@ -65,7 +65,7 @@ class CaseSettings: self.contents = default_contents.copy() self.expected_resources = [{ - '$schema': 'https://hydrilla.koszko.org/schemas/api_resource_description-1.schema.json', + '$schema': 'https://hydrilla.koszko.org/schemas/api_resource_description-1.0.1.schema.json', 'source_name': 'hello', 'source_copyright': [{ 'file': 'report.spdx', @@ -91,7 +91,7 @@ class CaseSettings: }], 'generated_by': expected_generated_by }, { - '$schema': 'https://hydrilla.koszko.org/schemas/api_resource_description-1.schema.json', + '$schema': 'https://hydrilla.koszko.org/schemas/api_resource_description-1.0.1.schema.json', 'source_name': 'hello', 'source_copyright': [{ 'file': 'report.spdx', @@ -115,7 +115,7 @@ class CaseSettings: 'generated_by': expected_generated_by }] self.expected_mapping = { - '$schema': 'https://hydrilla.koszko.org/schemas/api_mapping_description-1.schema.json', + '$schema': 'https://hydrilla.koszko.org/schemas/api_mapping_description-1.0.1.schema.json', 'source_name': 'hello', 'source_copyright': [{ 'file': 'report.spdx', @@ -141,7 +141,7 @@ class CaseSettings: 'generated_by': expected_generated_by } self.expected_source_description = { - '$schema': 'https://hydrilla.koszko.org/schemas/api_source_description-1.schema.json', + '$schema': 'https://hydrilla.koszko.org/schemas/api_source_description-1.0.1.schema.json', 'source_name': 'hello', 'source_copyright': [{ 'file': 'report.spdx', @@ -367,7 +367,7 @@ def test_build(tmpdir, prepare_source_example): with open(subdir / '2021.11.10', 'rt') as file_handle: assert json.load(file_handle) == resource_json - hydrilla_util.validator_for('api_resource_description-1.schema.json')\ + hydrilla_util.validator_for('api_resource_description-1.0.1.schema.json')\ .validate(resource_json) # Verify files under 'mapping/' @@ -380,7 +380,7 @@ def test_build(tmpdir, prepare_source_example): with open(subdir / '2021.11.10', 'rt') as file_handle: assert json.load(file_handle) == settings.expected_mapping - hydrilla_util.validator_for('api_mapping_description-1.schema.json')\ + hydrilla_util.validator_for('api_mapping_description-1.0.1.schema.json')\ .validate(settings.expected_mapping) # Verify files under 'source/' @@ -404,7 +404,7 @@ def test_build(tmpdir, prepare_source_example): with open(source_dir / 'hello.json', 'rt') as file_handle: assert json.load(file_handle) == settings.expected_source_description - hydrilla_util.validator_for('api_source_description-1.schema.json')\ + hydrilla_util.validator_for('api_source_description-1.0.1.schema.json')\ .validate(settings.expected_source_description) def modify_index_missing_file(dummy: CaseSettings, obj: dict) -> None: -- cgit v1.2.3