Multiple file upload - Got 400
See original GitHub issueHello,
In Open API V3 specs, it is possible to specify how multiple file upload is handled ( https://swagger.io/docs/specification/describing-request-body/file-upload/ ).
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
filename:
type: array
items:
type: string
format: binary
After that, I documented the following endpoint ( that does a bulk insert of exercises with their zip files sources ) :
/api/bulk_create_exercises:
post:
summary: "Creates multiple exercises into the system"
operationId: createMultipleExercises
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/MultipleExercisesForm"
multipart/form-data:
schema:
type: object
properties:
exercisesData:
$ref: "#/components/schemas/MultipleExercisesForm"
files:
type: array
description: "The sources of the exercises, each in zip format"
minItems: 1
items:
type: string
format: binary
description: "The source of an exercise, in zip format"
filesMapping:
type: array
description: "Mapping between the given file (to find out which data belong to exercise)"
minItems: 1
items:
type: object
properties:
filename:
type: string
description: "The name of the given source file"
example: "file1.zip"
exercise:
type: integer
description: "The location of the related exercise in the exercisesData array"
required:
- filename
- exercise
required:
- exercisesData
- files
- filesMapping
responses:
'200':
description: OK
# Definition of all error statuses
default:
description: "Whatever error : 4XX - Client error (Bad Request, Unauthorized, etc.) , 5XX - Server error"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorObject"
I expected this to work but I got a nice 400 error :
When I look up inside the req before my error handler throws the 400 status code, I see that :
And the files are correctly uploaded :
I checked in the tests and there is only single upload tests
Thanks for your help 😉
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
400 Bad request while uploading multiple files in Spring MVC ...
After form submission, i get an error 400 bad Request. I'm attaching the snapshot of my post parameters as well. Files are getting...
Read more >Bad Request 400 on file upload - Atlassian Community
My file (.csv) is 2.58MB and I continue to receive the 400 error. Isn't the file limit 100MB? The total lines in this...
Read more >Multiple file upload field getting HTTP status code 502 error ...
Multiple file upload field getting HTTP status code 502 error when uploading large ... I've tried to upload a 400MB video file and...
Read more >Canvas File Upload 400 Error: Request failed with status code ...
Our support team was able to increase the quota and file uploading worked like normal once again. Have you encountered this error? Did...
Read more >Restrictions and limitations in OneDrive and SharePoint
Files that are used by your local computer, such as desktop.ini on Windows or .ds_store on macOS, don't normally sync. If these files...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jy95 thanks for the PR! your work is a nice improvement over what is current. the change is merged and available in
v3.2.2
. thanks again!from request body i am sending a property files with correct type:string format:binary but still my validator is failing with 500 and in error as well in body object i cant see files property.I am not able to upload file.what is the solution? using latest version of this package.