Closed
Description
Hi there,
I've bumped into an error that never happened before upgrading to version 7.6.2.
I'm getting an error saying that an enum class instance is not json serializable. Here's the full error line:
File \"/usr/local/lib/python3.11/json/encoder.py\", line 180, in default\n raise TypeError(f'Object of type {o.__class__.__name__} '\nTypeError: Object of type QueueType is not JSON serializable\n"
QueueType
is an Enum
class as follows:
from enum import Enum
class QueueType(Enum):
OPERATOR = 'o'
EQUIPMENT = 'e'
SITE = 's'
and the code generating the error is the following:
# FastAPI endpoint
@router.put('/queue')
async def update_queue(queue_update: Queue):
try:
match = dict(type=queue_update.type, site_key=queue_update.site_key) # <-- the type parameter is of type QueueType
db.collection('Queue').update_match(match, queue_update, keep_none=False, sync=True) # <-- line raising the error
Any insight on what's happening? A regression?
Metadata
Metadata
Assignees
Labels
No labels