express-openapi-validator icon indicating copy to clipboard operation
express-openapi-validator copied to clipboard

Feature: Extendable fileUploader #248

Open dotMortis opened this issue 5 years ago • 4 comments

Feature: Extendable fileUploader #248

dotMortis avatar Nov 19 '20 16:11 dotMortis

@Haruki-Mortis @cdimascio I don't want to be bound to multer.any() as well and want to be able to provide custom uploader. My approach to implementing this is really simple. We can simply extend the fileUploader with an another prop, let's say uploadHandler, that is a function returned by multer().single("image") for example. Then instead of:

multer.any()(req, res, next) {...}.

we can do:

options.multOpts.uploadHandler(req, res, next) {...}

This is straightforward to implement and gives the user the ability to use multer without restrictions. I have already implemented and tested this approach exemplary, works fine. What do you say? Is this worth a PR?

setaman avatar Dec 22 '20 13:12 setaman

@Haruki-Mortis good idea. this will provide good flexibility

cdimascio avatar Dec 25 '20 16:12 cdimascio

Hello, any news on this ? I would like to use a custom implementation of multer too, to allow use of upload without multipart, like described here https://swagger.io/docs/specification/describing-request-body/file-upload/ Let me know if a new PR is welcome on this. PS: Thanks for this great tool you built !

devthejo avatar Mar 05 '22 09:03 devthejo

@devthejo I support the idea and welcome PRs.

cdimascio avatar Mar 05 '22 13:03 cdimascio