maximdanilchenko/aiohttp-apispec

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

alvarolopez opened this issue · 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.