Skip to content

replace_defs_in_schema does not handle $ref inside anyOf array (method="json_mode") #1023

Open
@jinohkang-theori

Description

@jinohkang-theori

In replace_defs_in_schema:

for key, value in original_schema.items():
if key == "$defs":
continue
if not isinstance(value, dict):
resulting_schema[key] = value
else:
if "$ref" in value:
new_value = value.copy()

Note that only dicts are handled, not lists. This skips nested schema inside arrays, such as {"anyOf": [{"$refs": "..."}]}.

This happens with Pydantic named RootModel[Type1 | Type2 | ...] union schemas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions