Skip to content

[Feature Request] Merge Redundant Model Naming in datamodel-codegen for Simplified Code Generation #1443

@alita-moore

Description

@alita-moore

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 #1418

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions