Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can 'multipart/form-data' be added to the output OpenAPI spec, for the @UploadedFiles decorator? #19

Open
sixman9 opened this issue Mar 3, 2019 · 3 comments

Comments

@sixman9
Copy link

sixman9 commented Mar 3, 2019

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

@epiphone
Copy link
Owner

epiphone commented Mar 4, 2019

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!

@Brian-NgH777
Copy link

Brian-NgH777 commented Aug 12, 2019

Hello @epiphone , how can I achieve additional 'multiple data / form data' using the router-controller-openapi / routing controller? Could you example me
Thank you

@nicholasbraun
Copy link

Any progress on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants