From 914689957dc776e958c4d4cc7e56e7e2ed9abfa2 Mon Sep 17 00:00:00 2001 From: Braden Mars Date: Sun, 23 Jul 2023 04:14:42 -0500 Subject: [PATCH] fix(backend): FastAPI docs broken due to missing schema for `NullableUUID` (#739) Just updates `NullableUUID` to extend from `UUID`. This lets FastAPI infer the correct field schema and resolves the /docs and /redocs endpoint failing to render Signed-off-by: Braden Mars --- backend/core/routes/chat_routes.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/core/routes/chat_routes.py b/backend/core/routes/chat_routes.py index 91ed78812..060e71d1a 100644 --- a/backend/core/routes/chat_routes.py +++ b/backend/core/routes/chat_routes.py @@ -28,13 +28,14 @@ from utils.constants import ( chat_router = APIRouter() -class NullableUUID: +class NullableUUID(UUID): + @classmethod def __get_validators__(cls): yield cls.validate @classmethod - def validate(cls, v): + def validate(cls, v) -> UUID | None: if v == "": return None try: