routing-controllers-openapi
routing-controllers-openapi copied to clipboard
Can 'multipart/form-data' be added to the output OpenAPI spec, for the @UploadedFiles decorator?
I'm new to Typescript/Javascript (Java Dev), but I'm trying to keep my development as DRY as possible.
I already know that my Express code works and can do 'multipart/form-data' file uploads, via the '@UploadedFiles' decorator, however, I'd like to see that reflected in the OpenAPI spec, output by your project, so any client code I generate will be aware of it (i.e. 'multipart/form-data').
How can I achieve the addition of 'multipart/form-data' programmatically, using routing-controllers-openapi/routing-controllers?
See https://swagger.io/docs/specification/describing-request-body/multipart-requests
Hi, handling @UploadedFile/ @UploadedFiles would indeed make a great addition, thanks for the suggestion! We'd probably need to extend the getRequestBody function to check for said decorators (route.params.filter(d => ['file', 'files'].includes(d.type)) and merge the multipart/form-data block you linked into the return object (along the existing application/json block).
Would be happy to merge in a PR if anyone gets around implementing this!
Hello @epiphone , how can I achieve additional 'multiple data / form data' using the router-controller-openapi / routing controller? Could you example me Thank you
Any progress on this?