You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Generating Python classes from an avro schema using dataclasses-avroschema.ModelGenerator.render method with the model_type argument set to ModelType.AVRODANTIC will render a Python class with the enum.
For example:
classSomeEnum(enum.Enum):
...
Describe the solution you'd like
Since enums in avro are always strings, it would be nice to have the aforementioned method render.
If we take the previous example:
classSomeEnum(str, enum.Enum):
...
Describe alternatives you've considered
NA
Additional context
NA
The text was updated successfully, but these errors were encountered:
Yes, it makes sense. We should do it regardless the ModelType that is used.
alxdrcirilo
changed the title
Make enums inherit from str and enum.Enum in ModelGenerator when rendering to ModelType.AVRODANTIC
Make enums inherit from str and enum.Enum in ModelGenerator.render
May 27, 2024
alxdrcirilo
added a commit
to alxdrcirilo/dataclasses-avroschema
that referenced
this issue
May 27, 2024
Is your feature request related to a problem? Please describe.
Generating
Python classes
from anavro schema
usingdataclasses-avroschema.ModelGenerator.render
method with themodel_type
argument set toModelType.AVRODANTIC
will render a Python class with the enum.For example:
Describe the solution you'd like
Since enums in avro are always strings, it would be nice to have the aforementioned method render.
If we take the previous example:
Describe alternatives you've considered
NA
Additional context
NA
The text was updated successfully, but these errors were encountered: