Skip to content

Commit

Permalink
fix: keep document-relative jsonpointer if present
Browse files Browse the repository at this point in the history
§refs may contain <NS>:<Document>#/path/in/document, anchor part shoul not be removed
  • Loading branch information
simontaurus committed May 24, 2024
1 parent e3492b3 commit b6c4be9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/osw/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ def _fetch_schema(self, fetchSchemaParam: _FetchSchemaParam = None) -> None:
for i in range(0, schema_name.count("/")):
value += "../" # created relative path to top-level schema dir
value += ref_schema_name # create a reference to a local file
# keep document-relative jsonpointer if present
if "#/" in match.value:
value += "#/" + match.value.split("#/")[-1]
match.full_path.update_or_create(schema, value)
# print(f"replace {match.value} with {value}")
if (
Expand Down Expand Up @@ -436,6 +439,7 @@ def _fetch_schema(self, fetchSchemaParam: _FetchSchemaParam = None) -> None:
"from uuid import uuid4\n"
"from typing import Type, TypeVar\n"
"from osw.model.static import OswBaseModel, Ontology\n"
# "from osw.model.static import *\n"
"\n"
)

Expand Down

0 comments on commit b6c4be9

Please sign in to comment.