Skip to content

Commit

Permalink
Fix validation with no schema and improve error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
avillar committed Jul 4, 2024
1 parent f05639a commit 4819de1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ogc/bblocks/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,14 +732,17 @@ def validate_test_resources(bblock: BuildingBlock,
schema_url = next((u for u in bblock.metadata.get('schema', []) if u.endswith('.json')), None)

try:
if bblock.annotated_schema:
if bblock.annotated_schema.is_file():
schema_validator = get_json_validator(bblock.annotated_schema_contents,
bblock.annotated_schema.resolve().as_uri(),
bblocks_register)
except Exception as e:
json_error = f"Error creating JSON validator: {type(e).__name__}: {e}"
try:
if bblock.jsonld_context.is_file():
jsonld_context = load_yaml(filename=bblock.jsonld_context)
except Exception as e:
json_error = f"{type(e).__name__}: {e}"
json_error = f"Error loading JSON-LD context: {type(e).__name__}: {e}"

if outputs_path:
output_dir = outputs_path / bblock.subdirs
Expand Down

0 comments on commit 4819de1

Please sign in to comment.