Skip to content

Commit

Permalink
Find invalid local $refs when resolving dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
avillar committed Apr 23, 2024
1 parent e4a611b commit 382fe54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ogc/bblocks/metadata-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ properties:
- parameter # OpenAPI parameter
- header # OpenAPI header
- cookie # OpenAPI cookie
- api # Partial or full OpenAPI Spec
- api # Partial or full OpenAPI document
register:
description: Register to which this Building Block belongs.
type: string
Expand Down
4 changes: 4 additions & 0 deletions ogc/bblocks/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,10 @@ def _resolve_bblock_deps(self, bblock: BuildingBlock) -> set[str]:
if source_fn.is_path:
# Check if target path in local bblock schemas
rel_ref = os.path.relpath(source_fn.parent.resolve_ref(ref).resolve())
if not Path(rel_ref).is_file():
raise ValueError(f"Invalid reference to {rel_ref}"
f" from {bblock.identifier} ({source_fn}) - target file does not exist"
f" - check that the file exists (maybe schema.yaml instead of schema.json?)")
else:
# Check if target URL in local bblock schemas
rel_ref = urljoin(source_fn.url, ref)
Expand Down

0 comments on commit 382fe54

Please sign in to comment.