Skip to content

Commit

Permalink
fix(backend): FastAPI docs broken due to missing schema for `Nullable…
Browse files Browse the repository at this point in the history
…UUID` (#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 <[email protected]>
  • Loading branch information
BradenM authored Jul 23, 2023
1 parent 97fd239 commit 9146899
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/core/routes/chat_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
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:
Expand Down

0 comments on commit 9146899

Please sign in to comment.