Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Python should be able to automatically cast strings to enums and throw runtime error where this is not possible #3038

Closed
billytrend-cohere opened this issue Feb 22, 2024 · 1 comment

Comments

@billytrend-cohere
Copy link

Problem description

Python should be able to automatically cast strings to enums and throw runtime error where this is not possible

Why would it be useful?

Useful in our case for backwards compatibility but also makes it convenient when you are passing strings around.

Describe the solution (optional)

enum arguments should be string union enum

@dsinghvi
Copy link
Member

This is supported in the latest version of Python generator with the following config:

config: 
  pydantic_config: 
    use_str_enum: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants