Skip to content

Commit

Permalink
Add sourceSchema metadata property
Browse files Browse the repository at this point in the history
  • Loading branch information
avillar committed Feb 2, 2024
1 parent cff7557 commit 565966c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ogc/bblocks/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ def do_postprocess(bblock: BuildingBlock, light: bool = False) -> bool:
ld_context_url = './' + os.path.relpath(bblock.jsonld_context, output_file_root)
bblock.metadata['ldContext'] = ld_context_url

if isinstance(bblock, str) and is_url(bblock.schema):
bblock.metadata['sourceSchema'] = bblock.schema
elif bblock.schema.is_file():
if base_url:
bblock.metadata['sourceSchema'] = f"{base_url}{os.path.relpath(bblock.schema, cwd)}"
else:
bblock.metadata['sourceSchema'] = f"./{os.path.relpath(bblock.schema, cwd)}"

rel_files_path = os.path.relpath(bblock.files_path)
if base_url:
bblock.metadata['sourceFiles'] = f"{base_url}{rel_files_path}/"
Expand Down

0 comments on commit 565966c

Please sign in to comment.