Skip to content

Commit 67bf614

Browse files
committed
fix: swagger multiple files upload issue python-restx#177
1 parent 88497ce commit 67bf614

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

flask_restx/swagger.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,8 @@ def serialize_operation(self, doc, method):
466466
doc_params = list(doc.get("params", {}).values())
467467
all_params = doc_params + (operation["parameters"] or [])
468468
if all_params and any(p["in"] == "formData" for p in all_params):
469-
if any(p["type"] == "file" for p in all_params):
469+
# if any(p["type"] == "file" for p in all_params): This doesn't allow multiple file upload
470+
if any(p["type"] == "file" or (p["type"] == "array" and p["items"]["type"]=="file") for p in all_params):
470471
operation["consumes"] = ["multipart/form-data"]
471472
else:
472473
operation["consumes"] = [

0 commit comments

Comments
 (0)