Skip to content

Commit b6c4be9

Browse files
committed
fix: keep document-relative jsonpointer if present
§refs may contain <NS>:<Document>#/path/in/document, anchor part shoul not be removed
1 parent e3492b3 commit b6c4be9

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/osw/core.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ def _fetch_schema(self, fetchSchemaParam: _FetchSchemaParam = None) -> None:
354354
for i in range(0, schema_name.count("/")):
355355
value += "../" # created relative path to top-level schema dir
356356
value += ref_schema_name # create a reference to a local file
357+
# keep document-relative jsonpointer if present
358+
if "#/" in match.value:
359+
value += "#/" + match.value.split("#/")[-1]
357360
match.full_path.update_or_create(schema, value)
358361
# print(f"replace {match.value} with {value}")
359362
if (
@@ -436,6 +439,7 @@ def _fetch_schema(self, fetchSchemaParam: _FetchSchemaParam = None) -> None:
436439
"from uuid import uuid4\n"
437440
"from typing import Type, TypeVar\n"
438441
"from osw.model.static import OswBaseModel, Ontology\n"
442+
# "from osw.model.static import *\n"
439443
"\n"
440444
)
441445

0 commit comments

Comments
 (0)