Skip to content

Make enum handling configurable #43

@fennerm

Description

@fennerm

I'd be down to submit a PR for this if you're open to it. Pointers on how you'd like the interface to be defined would be helpful though.

Is your feature request related to a problem? Please describe.
I'm working on a tool which autogenerates github actions from python scripts. Argdantic uses the enum name to define the allowed values. The problem is that this is inconsistent with pydantic, which uses the enum key value. This means that pydantic's schema cannot be used to determine the allowed values for an argument.

Describe the solution you'd like
Add a configuration option to the arg parser which toggles whether the enum key or value is used.

Describe alternatives you've considered
Personally I think the enum value would be a better default in general because the enum key is less flexible. E.g the key cannot contain certain characters. But figure this probably isn't worth a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions