I try to create a simple FastAPI app:
from pydantic import BaseModel
class RephrasingRequest(BaseModel):
content: str
"""The content to rephrase"""
n_outputs: int = 1
"""How many examples to generate?"""
app_debug = FastAPI(
title="debug", description="View project's README.md for details", docs_url="/"
)
@app_debug.post("/rephrase")
async def rephrase_question(request: RephrasingRequest) -> str:
msg = "got the request " + str(request)
return msg
When I go to the app SwaggerUI page, I see the endpoint documentation, but it says "No parameters", as if the function does not accept parameters.
screenshot of the original doc page
Also, and I think this is related, the UI doesn't format the documentation properly. For example, if I add the following docstring:
@app_debug.post("/rephrase")
async def rephrase_question(request: RephrasingRequest) -> str:
"""
This is a sample doc.
:param request:
The request
:return:
What we return
"""
msg = "got the request " + str(request)
return msg
the result is malformatted screenshot of the modififed doc page
(note that the formatting strings are there)
I expected to see propely formatted documentation, including a proper list of parameters