Skip to content

Remove default value for --output-model-type #2466

@ilovelinux

Description

@ilovelinux

Is your feature request related to a problem? Please describe.
Many people had issues with datamodel-codegen because they expected to get a Pydantic v2 model and they got a Pydantic v1 problem instead. I was one of them when I began to use the tool. See #803

Describe the solution you'd like
I'd suggest to remove the default value to enforce the users to declare it explicitly.

The current behavior has a few problems:

  • The default value has no reason to be the default value
  • When Pydantic v1 will be deprecated and supposedly removed from this tool, replacing a default value with another default value would be a very big breaking change.

Instead:

  • Removing the default value is a breaking change but it will lead to an explicit error about what's changed and how to fix that.
  • We can freely deprecate/remove any output model in the future, since the user will have the responsibility to choose a output model type, not the tool.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions