Open rezondrey opened 1 year ago
Is your feature request related to a problem? Please describe.
Python 3.11 has introduced some breaking changes for enums when used in f-strings.
class MyEnum(str, Enum): VALUE = "value" # Prior python 3.11: print(f'{MyEnum.VALUE}') # => "value" # Since python 3.11: print(f'{MyEnum.VALUE}') # => "MyEnum.VALUE"
This behavior is different when using the new StrEnum:
from enum import StrEnum class MyEnum(StrEnum): VALUE = "value" # Python 3.11: print(f'{MyEnum.VALUE}') # => "value"
This blog describes the problem: https://blog.pecar.me/python-enum
Describe the solution you'd like Add support for additional argument, or extend "--use-subclass-enum" to allow choosing between (str, Enum) and StrEnum
Or maybe even allow selecting base class for enums, for people using custom enum packages such as https://pypi.org/project/StrEnum/
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.
Hi, I installed version 0.25.8 and found the same: datamodel-code-generator creates classes from (str, Enum) instead of StrEnum
BR, George
Is your feature request related to a problem? Please describe.
Python 3.11 has introduced some breaking changes for enums when used in f-strings.
This behavior is different when using the new StrEnum:
This blog describes the problem: https://blog.pecar.me/python-enum
Describe the solution you'd like Add support for additional argument, or extend "--use-subclass-enum" to allow choosing between (str, Enum) and StrEnum
Or maybe even allow selecting base class for enums, for people using custom enum packages such as https://pypi.org/project/StrEnum/
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.