question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use decorator 'ApiImplicitBody' compile error.

See original GitHub issue

Hi, I used decorator ApiImplicitBody from ‘’@nestjs/swagge<v1.1.4>" in controller like this:

@ApiImplicitBody({ name: 'username', description: 'some', required: true, type: 'string' })
@Post('login')
@Bind(Body())
login(body) {}

But when I want to start the project throw compile error:

(node:18200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError
(node:18200) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I have no idea why this hanppend. Other decorator works well.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
dadepracommented, May 11, 2018

Hi @kamilmysliwiec you can reopen this issue?

1reaction
gkucmierzcommented, May 14, 2019

I figured out it is working with something like this:

class PostData {
  @ApiModelProperty()
  user: string;
  @ApiModelProperty()
  password: string;
}

@ApiImplicitBody({ name: 'body', required: true, type: PostData })

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Create a Compile Error on Method Decorators in ...
I am working on a library called expresskit that lets you use decorators to define routes/params/etc for express ...
Read more >
How to use the @nestjs/swagger.ApiOperation function in ...
To help you get started, we've selected a few @nestjs/swagger examples, based on popular ways it is used in public projects. Secure your...
Read more >
nestjs/swagger
Start using @nestjs/swagger in your project by running `npm i @nestjs/swagger`. ... The following decorators have been changed/renamed:.
Read more >
How To Add Summary And Body Manually In Swagger Nestjs
We will be using Flask, Swagger Code-Gen (OpenAPI) and Connexions. ... you can use "input types" for this, by using the input all...
Read more >
NestJS — The Hero We Didn't Know We Needed
This is a built-in Nest decorator that allows us to define what our params look like for this endpoint. In the strings, we're...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found