pythogen icon indicating copy to clipboard operation
pythogen copied to clipboard

Fix anyOf schema conflict

Open pradishb opened this issue 1 year ago • 0 comments

Fixes #83

Add parent_schema_id before anyOf schema to avoid conflict between anyOf schemas with same name.

class Schema2ValueObj(RootModel):
    """
    None

    """

    root: str | None


class Schema1ValueObj(RootModel):
    """
    None

    """

    root: int | None


class Schema2(BaseModel):
    """
    None

    """

    model_config = ConfigDict(
        populate_by_name=True,  # Addressing by field name, even if there is an alias.
    )
    value: Schema2ValueObj | None = None


class Schema1(BaseModel):
    """
    None

    """

    model_config = ConfigDict(
        populate_by_name=True,  # Addressing by field name, even if there is an alias.
    )
    value: Schema1ValueObj | None = None
    ```

pradishb avatar Sep 23 '24 21:09 pradishb