Skip to content

Commit

Permalink
Fallback to string for UUID columns
Browse files Browse the repository at this point in the history
  • Loading branch information
giorgiobasile committed Dec 12, 2024
1 parent 151344d commit 9b5ce6c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tipg/resources/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Any

import orjson
from asyncpg.pgproto import pgproto

from fastapi.responses import JSONResponse

Expand All @@ -12,6 +13,8 @@ def default(obj):
"""Instruct orjson what to do with types it does not natively serialize"""
if isinstance(obj, decimal.Decimal):
return str(obj)
elif isinstance(obj, pgproto.UUID):
return str(obj)


def orjsonDumps(content: Any):
Expand Down

0 comments on commit 9b5ce6c

Please sign in to comment.