Skip to content

feat(): upload file decorator#573

Closed
rafpran wants to merge 1 commit into
nestjs:masterfrom
rafpran:rafpran-file-upload-swagger
Closed

feat(): upload file decorator#573
rafpran wants to merge 1 commit into
nestjs:masterfrom
rafpran:rafpran-file-upload-swagger

Conversation

@rafpran

@rafpran rafpran commented Feb 19, 2020

Copy link
Copy Markdown

@see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#mediaTypeObject
According to spec multipart should be described in responseBody branch.
It is possible with use of @ApiBody annotation.
Code generator has been unnecesarily adding $ref to locally typed schema.

resolves: #167

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#mediaTypeObject
According to spec multipart should be described in responseBody branch.
It is possible with use of @ApiBody annotation.
Code generator has been unnecesarily adding $ref to locally typed schema.

resolves: nestjs#167
rafpran added a commit to rafpran/swagger that referenced this pull request Feb 19, 2020
@kamilmysliwiec kamilmysliwiec changed the title fix(): File upload feat(): upload file decorator Feb 21, 2020
@sempasha

sempasha commented Aug 21, 2020

Copy link
Copy Markdown

What is the reason, pull request is not merged yet?

  • Docs have been added / updated (for bug fixes / features)

?

@ApiConsumes('multipart/form-data')
@UseInterceptors(FileInterceptor('file'))
@ApiBody({
type: 'multipart/form-data',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type: 'multipart/form-data',

This isn't how the @ApiBody() decorator is supposed to work

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to upload file with additional form data

3 participants