sanic-org / sanic-openapi

Easily document your Sanic API with a UI
https://sanic-openapi.readthedocs.io/
MIT License
505 stars 108 forks source link

[Bug] #174

Closed nikhilpatil02 closed 4 years ago

nikhilpatil02 commented 4 years ago

Please suggest how can I have multiple files in form data with more keys in doc.consumes. As I am not able to add multiple files in form data

chenjr0719 commented 4 years ago

Hi there, would you please try this? It looks a little bit ugly but works. 😅

from sanic import Sanic
from sanic_openapi import doc, swagger_blueprint

app = Sanic("test")
app.blueprint(swagger_blueprint)

@app.get("/")
@doc.consumes(doc.File(name="file1"), location="formData", content_type="multipart/form-data")
@doc.consumes(doc.File(name="file2"), location="formData", content_type="multipart/form-data")
async def test(request):
    return {}

app.run()

I'm going to close this issue first and if you need more help, please feel free to reopen this issue. 😃