Skip to content
This repository was archived by the owner on Jun 21, 2025. It is now read-only.
This repository was archived by the owner on Jun 21, 2025. It is now read-only.

Type enum.Enum is not serializable #153

@aabrodskiy

Description

@aabrodskiy

One of my models has Enum fields in it, which can't seem to be currently handled and throw a type error.

Here is my simplified example:

class SomeType(enum.Enum):
    Interval = 'interval'

class SomeModel(Model):
    _primary_key_field: str = 'id'    
    id: str
    type: SomeType

Error message:
File "/home/.../.local/lib/python3.9/site-packages/pydantic_aioredis/abstract.py", line 80, in json_default
raise TypeError("Type %s not serializable" % type(obj))
TypeError: Type <enum 'SomeType'> not serializable

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