Skip to content

Commit 7c06ac6

Browse files
committed
Add abstract and description to register.json
1 parent d2cd244 commit 7c06ac6

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

ogc/bblocks/entrypoint.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
id_prefix = 'ogc.'
158158
annotated_path = Path(args.annotated_path)
159159
imported_registers = []
160+
register_additional_metadata = {}
160161
if bb_config_file and bb_config_file.is_file():
161162
bb_config = load_yaml(filename=bb_config_file)
162163
id_prefix = bb_config.get('identifier-prefix', id_prefix)
@@ -169,6 +170,13 @@
169170
else:
170171
imported_registers = [ir if ir != DEFAULT_IMPORT_MARKER else MAIN_BBR for ir in imported_registers if ir]
171172

173+
register_abstract = bb_config.get('abstract')
174+
if register_abstract:
175+
register_additional_metadata['abstract'] = register_abstract
176+
register_description = bb_config.get('description')
177+
if register_description:
178+
register_additional_metadata['description'] = register_description
179+
172180
base_url = args.base_url
173181
github_base_url = args.github_base_url
174182
git_repo_path = None
@@ -207,7 +215,8 @@
207215
bb_filter=args.filter,
208216
steps=steps,
209217
git_repo_path=git_repo_path,
210-
viewer_path=(args.viewer_path or '.') if deploy_viewer else None)
218+
viewer_path=(args.viewer_path or '.') if deploy_viewer else None,
219+
additional_metadata=register_additional_metadata)
211220

212221
# 2. Uplift register.json
213222
print(f"Running semantic uplift of {register_file}", file=sys.stderr)

ogc/bblocks/postprocess.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def postprocess(registered_items_path: str | Path = 'registereditems',
3838
steps: list[str] | None = None,
3939
bbr_config: dict | None = None,
4040
git_repo_path: Path | None = None,
41-
viewer_path: str | Path | None = None) -> list[dict]:
41+
viewer_path: str | Path | None = None,
42+
additional_metadata: dict | None = None) -> list[dict]:
4243

4344
cwd = Path().resolve()
4445

@@ -328,6 +329,12 @@ def do_postprocess(bblock: BuildingBlock, light: bool = False) -> bool:
328329
output_register_json['viewerURL'] = urljoin(base_url, viewer_path)
329330
if full_validation_report_url:
330331
output_register_json['validationReport'] = full_validation_report_url
332+
333+
if additional_metadata:
334+
for k, v in additional_metadata.items():
335+
if k not in output_register_json:
336+
output_register_json[k] = v
337+
331338
if output_file == '-':
332339
print(json.dumps(output_register_json, indent=2, cls=CustomJSONEncoder))
333340
else:

0 commit comments

Comments
 (0)