aiohttp-apispec icon indicating copy to clipboard operation
aiohttp-apispec copied to clipboard

Automatically set the location of an argument if it is a file

Open alvarolopez opened this issue 4 years ago • 0 comments

If I define the following argument and add it to my spec, the Swagger spec and UI correctly renders it (i.e. I can upload a file from the UI, and the spec contains the correct properties).

fields.Field(
    description="Data file to perform inference.",
    required=True,
    location="form",
    type="file"
)

However, files must be sent as multipart/form-data, therefore adding the location="form" is mandatory in such cases.

As a wishlist, this could be avoided if we automatically set location="form" if a defined argument is of type file.

alvarolopez avatar Oct 30 '19 11:10 alvarolopez