You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now all six endpoints return plain dict / JSONResponse objects constructed by hand in app.py. FastAPI can infer loose schemas from the return type hints but there is no enforced contract between the backend and the frontend, and the OpenAPI schema that FastAPI generates is correspondingly thin.
Adding Pydantic response models would:
Give the frontend a stable contract to rely on. Serialization drift between backend versions would fail in the route handler rather than silently returning a malformed shape to the UI.
Catch bugs at the boundary. If serialize_arrow_value returns something that does not match the declared shape, Pydantic raises a clear validation error instead of the frontend getting mystery fields.
No new dependencies: Pydantic is already a transitive dependency of FastAPI.
Scope: one model per endpoint (six total), plus the nested shapes for /schema, /columns, and the vector cell object. Can be done in a single PR without touching any business logic, just the return types and response construction.
Right now all six endpoints return plain
dict/JSONResponseobjects constructed by hand inapp.py. FastAPI can infer loose schemas from the return type hints but there is no enforced contract between the backend and the frontend, and the OpenAPI schema that FastAPI generates is correspondingly thin.Adding Pydantic response models would:
/docs.serialize_arrow_valuereturns something that does not match the declared shape, Pydantic raises a clear validation error instead of the frontend getting mystery fields.No new dependencies: Pydantic is already a transitive dependency of FastAPI.
Sketch:
Scope: one model per endpoint (six total), plus the nested shapes for
/schema,/columns, and the vector cell object. Can be done in a single PR without touching any business logic, just the return types and response construction.