Revision 9271ca7b
Added by koszko over 1 year ago
src/hydrilla/builder/build.py | ||
---|---|---|
44 | 44 |
|
45 | 45 |
_ = util.translation(here / 'locales').gettext |
46 | 46 |
|
47 |
index_validator = util.validator_for('package_source-1.schema.json') |
|
47 |
index_validator = util.validator_for('package_source-1.0.1.schema.json')
|
|
48 | 48 |
|
49 | 49 |
schemas_root = 'https://hydrilla.koszko.org/schemas' |
50 | 50 |
|
... | ... | |
290 | 290 |
new_item_obj.update([(p, item_def[p]) for p in copy_props]) |
291 | 291 |
|
292 | 292 |
new_item_obj['version'] = util.normalize_version(item_def['version']) |
293 |
new_item_obj['$schema'] = f'{schemas_root}/api_{item_def["type"]}_description-1.schema.json' |
|
293 |
new_item_obj['$schema'] = f'{schemas_root}/api_{item_def["type"]}_description-1.0.1.schema.json'
|
|
294 | 294 |
new_item_obj['source_copyright'] = self.copyright_file_refs |
295 | 295 |
new_item_obj['source_name'] = self.source_name |
296 | 296 |
new_item_obj['generated_by'] = generated_by |
... | ... | |
309 | 309 |
""" |
310 | 310 |
index_validator.validate(index_obj) |
311 | 311 |
|
312 |
schema = f'{schemas_root}/api_source_description-1.schema.json' |
|
312 |
schema = f'{schemas_root}/api_source_description-1.0.1.schema.json'
|
|
313 | 313 |
|
314 | 314 |
self.source_name = index_obj['source_name'] |
315 | 315 |
|
src/hydrilla/schemas | ||
---|---|---|
1 |
Subproject commit 5ef63e81ddd7299bfb738cae643bc48560b68a17 |
|
1 |
Subproject commit 09634f3446866f712a022327683b1149d8f46bf0 |
src/hydrilla/util/_util.py | ||
---|---|---|
111 | 111 |
return '.'.join([str(n) for n in ver]) + ('' if rev is None else f'-{rev}') |
112 | 112 |
|
113 | 113 |
schemas = {} |
114 |
for path in (here.parent / 'schemas').glob('*-1.schema.json'): |
|
114 |
for path in (here.parent / 'schemas').glob('*-1.0.1.schema.json'):
|
|
115 | 115 |
schema = json.loads(path.read_text()) |
116 | 116 |
schemas[schema['$id']] = schema |
117 | 117 |
|
src/test/test_hydrilla_builder.py | ||
---|---|---|
65 | 65 |
self.contents = default_contents.copy() |
66 | 66 |
|
67 | 67 |
self.expected_resources = [{ |
68 |
'$schema': 'https://hydrilla.koszko.org/schemas/api_resource_description-1.schema.json', |
|
68 |
'$schema': 'https://hydrilla.koszko.org/schemas/api_resource_description-1.0.1.schema.json',
|
|
69 | 69 |
'source_name': 'hello', |
70 | 70 |
'source_copyright': [{ |
71 | 71 |
'file': 'report.spdx', |
... | ... | |
91 | 91 |
}], |
92 | 92 |
'generated_by': expected_generated_by |
93 | 93 |
}, { |
94 |
'$schema': 'https://hydrilla.koszko.org/schemas/api_resource_description-1.schema.json', |
|
94 |
'$schema': 'https://hydrilla.koszko.org/schemas/api_resource_description-1.0.1.schema.json',
|
|
95 | 95 |
'source_name': 'hello', |
96 | 96 |
'source_copyright': [{ |
97 | 97 |
'file': 'report.spdx', |
... | ... | |
115 | 115 |
'generated_by': expected_generated_by |
116 | 116 |
}] |
117 | 117 |
self.expected_mapping = { |
118 |
'$schema': 'https://hydrilla.koszko.org/schemas/api_mapping_description-1.schema.json', |
|
118 |
'$schema': 'https://hydrilla.koszko.org/schemas/api_mapping_description-1.0.1.schema.json',
|
|
119 | 119 |
'source_name': 'hello', |
120 | 120 |
'source_copyright': [{ |
121 | 121 |
'file': 'report.spdx', |
... | ... | |
141 | 141 |
'generated_by': expected_generated_by |
142 | 142 |
} |
143 | 143 |
self.expected_source_description = { |
144 |
'$schema': 'https://hydrilla.koszko.org/schemas/api_source_description-1.schema.json', |
|
144 |
'$schema': 'https://hydrilla.koszko.org/schemas/api_source_description-1.0.1.schema.json',
|
|
145 | 145 |
'source_name': 'hello', |
146 | 146 |
'source_copyright': [{ |
147 | 147 |
'file': 'report.spdx', |
... | ... | |
367 | 367 |
with open(subdir / '2021.11.10', 'rt') as file_handle: |
368 | 368 |
assert json.load(file_handle) == resource_json |
369 | 369 |
|
370 |
hydrilla_util.validator_for('api_resource_description-1.schema.json')\ |
|
370 |
hydrilla_util.validator_for('api_resource_description-1.0.1.schema.json')\
|
|
371 | 371 |
.validate(resource_json) |
372 | 372 |
|
373 | 373 |
# Verify files under 'mapping/' |
... | ... | |
380 | 380 |
with open(subdir / '2021.11.10', 'rt') as file_handle: |
381 | 381 |
assert json.load(file_handle) == settings.expected_mapping |
382 | 382 |
|
383 |
hydrilla_util.validator_for('api_mapping_description-1.schema.json')\ |
|
383 |
hydrilla_util.validator_for('api_mapping_description-1.0.1.schema.json')\
|
|
384 | 384 |
.validate(settings.expected_mapping) |
385 | 385 |
|
386 | 386 |
# Verify files under 'source/' |
... | ... | |
404 | 404 |
with open(source_dir / 'hello.json', 'rt') as file_handle: |
405 | 405 |
assert json.load(file_handle) == settings.expected_source_description |
406 | 406 |
|
407 |
hydrilla_util.validator_for('api_source_description-1.schema.json')\ |
|
407 |
hydrilla_util.validator_for('api_source_description-1.0.1.schema.json')\
|
|
408 | 408 |
.validate(settings.expected_source_description) |
409 | 409 |
|
410 | 410 |
def modify_index_missing_file(dummy: CaseSettings, obj: dict) -> None: |
Also available in: Unified diff
update schema versions to 1.0.1