Skip to content

Commit

Permalink
Fix docs for pydantic 2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
larsevj committed Sep 6, 2024
1 parent 54654a1 commit 709f8b1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/semeio/_docs_utils/_json_schema_2_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@


def _insert_ref(schema: dict, defs: dict) -> None:
for value in schema.values():
schema_copy = schema.copy()
for index, value in schema_copy.items():
if isinstance(value, dict):
_insert_ref(value, defs)
schema[index] = _insert_ref(value, defs)
elif isinstance(value, list):
for index, val in enumerate(value.copy()):
if isinstance(val, int):
val = str(val)
if "$ref" in val:
value[index] = defs[val["$ref"]].pop("properties")
elif index == "$ref":
del schema["$ref"]
schema["must be"] = defs[value].pop("properties")
return schema


def _remove_key(schema: dict, del_key: str) -> None:
Expand Down

0 comments on commit 709f8b1

Please sign in to comment.