I have a fastify project that is using fastify-multipart for a file upload endpoint. With fastify-multipart registered, all requests sent to my api, including endpoints that have nothing to do with files, will return an error from the openapi-validator:
š ~ requestFilesExtractor.js
š ~ req.file: [AsyncFunction: getMultipartFile]
š ~ req.files: [AsyncGeneratorFunction: getMultipartFiles]
š ~ app.setErrorHandler ~ error: TypeError: files.push is not a function
at module.exports (C:\wrkspc\...\app\node_modules\openapi-validator-middleware\src\utils\requestFilesExtractor.js:7:19)
requestFilesExtractor.js file checks if req.file or req.files exists, and then proceeds to do other stuff. When fastify-multipart is registered, req.file and req.files are async functions and so they pass the check for existence, but then the proceeding logic bombs out when it tries handle them.
This has probably something to do with openapi-validator using express/multer under the hood but I'm not sure of a path forward except maybe having to install fastify-express along with express/multer and redoing my controller logic for handling files..
I have a fastify project that is using fastify-multipart for a file upload endpoint. With fastify-multipart registered, all requests sent to my api, including endpoints that have nothing to do with files, will return an error from the openapi-validator:
requestFilesExtractor.js file checks if req.file or req.files exists, and then proceeds to do other stuff. When fastify-multipart is registered, req.file and req.files are async functions and so they pass the check for existence, but then the proceeding logic bombs out when it tries handle them.
This has probably something to do with openapi-validator using express/multer under the hood but I'm not sure of a path forward except maybe having to install fastify-express along with express/multer and redoing my controller logic for handling files..