datamodel-code-generator
datamodel-code-generator copied to clipboard
[Feature Request] Merge Redundant Model Naming in datamodel-codegen for Simplified Code Generation
Is your feature request related to a problem? Please describe. I'd like a feature in datamodel-codegen that eliminates redundancy in model naming, allowing for the merging of schema and model class references into a single name to simplify generated code.
Describe the solution you'd like when I do --reuse-model it would be nice to have the option to merge the naming / reference into a single one. i.e. currently I might have something like
class BoundingRegionSchema(BaseModel):
...etc
class BoundingRegion(BoundingRegionSchema):
pass
But this makes for more confusing relationships, is there a way to collapse these references into BoundingRegionSchema?
Describe alternatives you've considered An alternative I've thought about but not yet implemented involves performing a manual or programmatic analysis of the output. The idea is to identify classes that only contain "pass" as their content, then replace all references to these classes with their corresponding parent classes.
Additional context This is born from https://github.com/koxudaxi/datamodel-code-generator/issues/1418