Swagger: @Body not pulling model without @ApiImplicitBody

Created on 11 Mar 2019  路  9Comments  路  Source: nestjs/swagger

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior


As described by #65, I followed the NestJS Swagger walkthrough and my model did not show up with only using @Body, and began to work correctly after using @ApiImplicitBody as described in #65.

Expected behavior


Model should come through as described by the NestJS swagger docs walkthrough.

Minimal reproduction of the problem with instructions

  1. Spin up Nest project _inside an Nx project_
  2. Add and setup nestjs/swagger
  3. Setup controller with a @Post and a @Body
  4. Setup DTO with @ApiModelProperty
  5. Observe in the Swagger docs, no model comes through
  6. Add @ApiImplicitBody as described in #65
  7. Observe in the Swagger docs, a model now comes through

What is the motivation / use case for changing the behavior?


Hope to use as it's described, don't want to use @ApiImplicitBody if it's not required.

Environment


Nest version: 5.5.0
Nest/Swagger version: 2.5.1

For Tooling issues:

  • Node version: 10.15.3
  • Platform: Mac
needs clarification

Most helpful comment

@Kanti look this it!
Change in the file of project tsconfig.json where "target": "es5" to "target": "es6" it is solved!

All 9 comments

Same here

Please, provide a minimal repository which reproduces your issue. It would help a lot :)

Hi,
We have the same Problem. I made a repository for you @kamilmysliwiec:
https://github.com/Kanti/nestjs-swagger-bug-demo

I'm stumped on this one.. somehow, this just started working in my current project and I was able to remove all the ApiImplicitBody and Param decorators, but I have no idea why it started working.

I cloned @Kanti's repository and can confirm seeing the issue, and I haven't been able to get it to work without the decorator.

bug is exists on current last modules of nest

@Kanti look this it!
Change in the file of project tsconfig.json where "target": "es5" to "target": "es6" it is solved!

@carloscfcortez thank you this worked for me, too.
you can see it here: https://github.com/Kanti/nestjs-swagger-bug-demo/pull/1/files

@jsonberry this worked for you?
if yes, then @kamilmysliwiec you can close this issue!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mogusbi picture mogusbi  路  3Comments

dennisameling picture dennisameling  路  4Comments

ivashog picture ivashog  路  3Comments

itslenny picture itslenny  路  3Comments

malbertSC picture malbertSC  路  5Comments