Skip to content

Commit

Permalink
Add more metadata to register.json
Browse files Browse the repository at this point in the history
  • Loading branch information
avillar committed Dec 28, 2023
1 parent aa669ea commit 17e61ab
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ogc/bblocks/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ def postprocess(registered_items_path: str | Path = 'registereditems',
github_base_url: str | None = None,
imported_registers: list[str] | None = None,
bb_filter: str | None = None,
steps: list[str] | None = None) -> list[dict]:
steps: list[str] | None = None,
bbr_config: dict | None = None) -> list[dict]:

cwd = Path().resolve()

if bbr_config is None:
bbr_config = {}

if not isinstance(test_outputs_path, Path):
test_outputs_path = Path(test_outputs_path)
if not steps or 'tests' in steps:
Expand Down Expand Up @@ -281,15 +285,24 @@ def do_postprocess(bblock: BuildingBlock, light: bool = False) -> bool:
else:
print(f"{building_block.identifier} failed postprocessing, skipping...", file=sys.stderr)

full_validation_report_url = None
if not steps or 'tests' in steps:
print(f"Writing full validation report to {test_outputs_path / 'report.html'}", file=sys.stderr)
if test_outputs_base_url:
full_validation_report_url = test_outputs_base_url + 'report.html'
report_to_html(json_reports=validation_reports, report_fn=test_outputs_path / 'report.html')

if output_file and (not steps or 'register' in steps):
output_register_json = {
'imports': imported_registers or [],
'bblocks': output_bblocks,
}
if bbr_config.get('name'):
output_register_json['name'] = bbr_config['name']
if base_url:
output_register_json['baseURL'] = base_url
if full_validation_report_url:
output_register_json['validationReport'] = full_validation_report_url
if output_file == '-':
print(json.dumps(output_register_json, indent=2, cls=CustomJSONEncoder))
else:
Expand Down

0 comments on commit 17e61ab

Please sign in to comment.