pythogen
pythogen copied to clipboard
Fix anyOf schema conflict
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
```