Closed mattdean-digicatapult closed 2 months ago
Hello there mattdean-digicatapult 👋
Thank you for opening your very first issue in this project.
We will try to get back to you as soon as we can.👀
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
@WoH as far as I'm aware this is still an issue. Do you know if this has been fixed in a PR or if this was closed because of it going stale? If the latter can you please re-open the issue?
Also if my proposed fix is likely to be accepted I'm happy to submit a PR, I was just hoping someone from the project would comment that it sounded sensible.
I also experience this issue
+1
I think we should reopen this issue.
+1, same here
+1 as of today
When using either
@UploadedFile
or@UploadedFiles
to configure a form post to do a file upload the builtroutes.ts
file contains invalid code.Sorting
I'm submitting a ...
I confirm that I
Expected Behavior
A handler with a file upload should stil compile to valid typescript which is compatible with multer type definitions:
Current Behavior
The built
routes.ts
is not valid against the multer type definitions. An excess propertymultiple
is populated on an object literal that is not defined on themulter.Multer.Field
Possible Solution
Remove this line https://github.com/lukeautry/tsoa/blame/d4a33015a7c0671cae8c24aae5afa3ea1fe44064/packages/cli/src/routeGeneration/routeGenerator.ts#L113 as it doesn't seem to add anything multer expects?
Steps to Reproduce
We've hit this on all our repos that do file upload. https://github.com/digicatapult/sqnc-matchmaker-api/pull/385 is one example.
You can also just create a handler as described in the expected behaviour section above
Context (Environment)
Version of the library: v6.3.1 Version of NodeJS: v20.x.x Version of Typescript: v5.4.5 Version of Multer: 1.4.5-lts.1
Detailed Description
When using either
@UploadedFile
or@UploadedFiles
to configure a form post to do a file upload the builtroutes.ts
contains in the request handler the code:The problem with this is the type of
multer.Multer.Field
doesn't actually contain a propertymultiple
see types package. Typescript therefore throw a build error:I came across this during an upgrade to tsoa v6.3.0 but it also applied to the latest v6.3.1. This change was introduced in https://github.com/lukeautry/tsoa/pull/1620
Honestly maybe I'm missing something obvious as that field was clearly added in the above PR with intent. Looking at
multer
's source code however I cannot see anything that references a propertymultiple
on a field.Breaking change?
N/A