Skip to content

Commit

Permalink
fix: swagger multiple files upload issue python-restx#177
Browse files Browse the repository at this point in the history
  • Loading branch information
ClimenteA committed Oct 6, 2021
1 parent 88497ce commit 67bf614
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flask_restx/swagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,8 @@ def serialize_operation(self, doc, method):
doc_params = list(doc.get("params", {}).values())
all_params = doc_params + (operation["parameters"] or [])
if all_params and any(p["in"] == "formData" for p in all_params):
if any(p["type"] == "file" for p in all_params):
# if any(p["type"] == "file" for p in all_params): This doesn't allow multiple file upload
if any(p["type"] == "file" or (p["type"] == "array" and p["items"]["type"]=="file") for p in all_params):
operation["consumes"] = ["multipart/form-data"]
else:
operation["consumes"] = [
Expand Down

0 comments on commit 67bf614

Please sign in to comment.