Skip to content

Commit

Permalink
Use annotated schema for validating schema-ref examples
Browse files Browse the repository at this point in the history
Fixes issues with bblocks:// URIs in the source schema
(which was previously used).
  • Loading branch information
avillar committed Feb 14, 2024
1 parent f1524d4 commit a2d59ef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ogc/bblocks/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,13 +795,13 @@ def validate_test_resources(bblock: BuildingBlock,
else:
schema_ref = snippet['schema-ref']
random_fn = f"example.{time()}.{random.randint(0,1000)}.yaml"
schema_uri = bblock.schema.with_name(random_fn).as_uri()
schema_uri = bblock.schema.with_name(random_fn).resolve().as_uri()
if schema_ref.startswith('#/'):
schema_ref = f"{bblock.schema}{schema_ref}"
schema_ref = f"{bblock.annotated_schema.resolve()}{schema_ref}"
elif not is_url(schema_ref):
if '#' in schema_ref:
path, fragment = schema_ref.split('#', 1)
schema_ref = f"{bblock.schema.parent.joinpath(path)}#{fragment}"
schema_ref = f"{bblock.annotated_schema.parent.resolve().joinpath(path)}#{fragment}"
schema_uri = (f"{bblock.schema.parent.joinpath(path).with_name(random_fn).as_uri()}"
f"#{fragment}")
else:
Expand Down

0 comments on commit a2d59ef

Please sign in to comment.