cdimascio / express-openapi-validator

🦋 Auto-validates api requests, responses, and securities using ExpressJS and an OpenAPI 3.x specification
MIT License
913 stars 208 forks source link

Multipart data does not work with latest release (4.13.8) #745

Open mmberk opened 2 years ago

mmberk commented 2 years ago

Describe the bug When calling the post api on a multipart request body, it fails with 4.13.8 but works with 4.13.5.

To Reproduce Here is the request body definition

requestBody: content: multipart/form-data: schema: properties: file: type: string format: binary

Actual behavior The data is not captured and saved in the file property

Expected behavior The data should be read from the stream and placed in file property

Examples and context Please see to reproduce section

brendon-stephens commented 2 years ago

I thought I had the same issue but it turns out that the base path (server/url prop) was wrong in my spec and did not match what I was sending... it appears to skip lookup of the config but still match on the controller route.

zhi-cloud-ai commented 1 year ago

multi-files upload is not working when the property is an array and only 1 file is being sent:

picture:
  type: array
  items:
    type: string
    format: binary
  maxItems: 9
  minItems: 1

similar issue described on https://github.com/cdimascio/express-openapi-validator/issues/176 but issue showed up again in latest release

Bec-k commented 1 year ago

Same here, not working and throwing error:

Error: Unexpected end of form
    at Multipart._final (/var/local/acp/dashboards/node_modules/busboy/lib/types/multipart.js:588:17)
    at callFinal (node:internal/streams/writable:698:12)
    at prefinish (node:internal/streams/writable:710:7)
    at finishMaybe (node:internal/streams/writable:720:5)
    at Multipart.Writable.end (node:internal/streams/writable:634:5)
    at onend (node:internal/streams/readable:705:10)
    at processTicksAndRejections (node:internal/process/task_queues:77:11)
Darkmift commented 3 months ago

still ongoing issue?