Describe the bug
Majority, if not all, of our api endpoints for the backend (app/api/v1/*.py) do not make use of our Pydantic models for responses (app/schemas/*.py). Instead, they are described as returning a dict. While this works and it isn't inaccurate, we do have the ability to be more specific.
On major benefit we get from using our Pydantic models (that we already have made) is the documentation. FastAPI autogenerates docs for us using OpenAPI and Swagger. These tools use the type-hinted return type to populate the documentation with decent examples of responses for each endpoint.
Expected behavior
We should always be returning a Pydantic model. The only possible exemption would be if we are returning very primitive data.
For example, endpoints that return a count may want to list their return type as ints instead of wrapping it in a response model.
Or maybe not, idk.
Steps to Reproduce
- Start up the backend using docker
- Navigate to the docs pages
a. OpenAPI: http://localhost:8080/docs/
b. Swagger: http://localhost:8080/redoc/
- Find an endpoint and read the documentation on it
- Notice that the "Response" section does not give a detailed example
Possible solution (optional)
Replace the return type for our endpoints with the response models defined in app/schemas/*.py.
If you don't have a response model, one will be provided for you (or you gotta make them, I don't make the rules ¯\_(ツ)_/¯ ).
My platform
No response
Additional context
Method returns dict
Method returns Pydantic Model

Describe the bug
Majority, if not all, of our api endpoints for the backend (
app/api/v1/*.py) do not make use of our Pydantic models for responses (app/schemas/*.py). Instead, they are described as returning adict. While this works and it isn't inaccurate, we do have the ability to be more specific.On major benefit we get from using our Pydantic models (that we already have made) is the documentation. FastAPI autogenerates docs for us using OpenAPI and Swagger. These tools use the type-hinted return type to populate the documentation with decent examples of responses for each endpoint.
Expected behavior
We should always be returning a Pydantic model. The only possible exemption would be if we are returning very primitive data.
For example, endpoints that return a count may want to list their return type as
ints instead of wrapping it in a response model.Or maybe not, idk.
Steps to Reproduce
a. OpenAPI: http://localhost:8080/docs/
b. Swagger: http://localhost:8080/redoc/
Possible solution (optional)
Replace the return type for our endpoints with the response models defined in
app/schemas/*.py.If you don't have a response model, one will be provided for you (or you gotta make them, I don't make the rules ¯\_(ツ)_/¯ ).
My platform
No response
Additional context
Method returns
dictMethod returns Pydantic Model