-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Labels
Description
First check
- [✔️] I used the GitHub search to find a similar issue and didn't find it.
- [✔️] I searched the FastAPI documentation, with the integrated search.
- [✔️] I already searched in Google "How to X in FastAPI" and didn't find any information.
Description
Is it possible to customise the documentation generated by fastapi when I define an UploadFile object to a POST method?
Additional context
Say for example I had a method like this where a file can be uploaded:
@router.post("/entity/new",)
async def upload_new_entity(file: UploadFile = File(...):
return {"filename": file.filename}This seems to generate an entry in the schemas section of the docs with the pattern of Body<func_name><path><method>
So my example above will have a Schema entry with the name:
Body_upload_new_entity_entity_new_post
The docs for UploadFile don't mention anything about OpenAPI docs.
Is it possible to specify a name for this UploadFile instead? And ideally also customise the details within the schema?
Thanks
illagrenan, synchronizing, danish-wani, rexwangcc, hyzyla and 2 more