Skip to content

Commit

Permalink
Avoid error when $id is not string
Browse files Browse the repository at this point in the history
  • Loading branch information
avillar committed Dec 9, 2023
1 parent fa23d8d commit ac3a96e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ogc/bblocks/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,8 @@ def apply_fixes(parent):
if add_nullable:
parent['nullable'] = True

def walk(subschema, schema_id: str | Path, is_properties: bool = False) -> tuple[dict, str, str | Path]:
def walk(subschema: dict | list, schema_id: str | Path, is_properties: bool = False) \
-> tuple[dict | list, str | None, str | Path]:
schema_version = None
if isinstance(subschema, list):
for item in subschema:
Expand All @@ -778,7 +779,7 @@ def walk(subschema, schema_id: str | Path, is_properties: bool = False) -> tuple

schema_version = subschema.pop('$schema', None)
schema_id = subschema.pop('$id', schema_id)
if isinstance(subschema.get('$ref'), str):
if isinstance(schema_id, str) and isinstance(subschema.get('$ref'), str):

ref = f"{schema_url}#/x-defs/{get_ref_mapping(schema_id, subschema.pop('$ref'))}"

Expand Down

0 comments on commit ac3a96e

Please sign in to comment.