From a2d59ef7e0cc2096ad2f1082c363b1e0311f5eeb Mon Sep 17 00:00:00 2001 From: Alejandro Villar Date: Wed, 14 Feb 2024 17:32:47 +0100 Subject: [PATCH] Use annotated schema for validating schema-ref examples Fixes issues with bblocks:// URIs in the source schema (which was previously used). --- ogc/bblocks/validate.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ogc/bblocks/validate.py b/ogc/bblocks/validate.py index fb7a118..e7aaa40 100644 --- a/ogc/bblocks/validate.py +++ b/ogc/bblocks/validate.py @@ -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: