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
{{ message }}
This repository was archived by the owner on Oct 19, 2022. It is now read-only.
We try to use the same serializer for loading and dumping, and some of our internal objects are simple dicts with string fields, and we are forced to manually convert strings to enums or load our internal entities by schema in order to dump them. We would like to be able to
class ImageOsTypeEnum(str, Enum):
linux = 'linux'
windows = 'windows'
class OpenstackKeypairListSerializer(Schema):
os_type = EnumField(ImageOsTypeEnum, required=False)
OpenstackKeypairListSerializer().dump({'os_type': 'linux'})
without converting 'linux' to enum beforehand.
We could use OneOf and Str, but Enums are much more readable and work great with type hints.
We try to use the same serializer for loading and dumping, and some of our internal objects are simple dicts with string fields, and we are forced to manually convert strings to enums or load our internal entities by schema in order to dump them. We would like to be able to
without converting 'linux' to enum beforehand.
We could use OneOf and Str, but Enums are much more readable and work great with type hints.