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.

ApiImplicitBody throws error

See original GitHub issue

I’m submitting a…


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

Current behavior

When I put @ApiImplicitBody({name: 'choice'}) to a patch method I get the following error:

(node:22562) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property prototype of 'undefined' or 'null'. at Object.exports.exploreModelDefinition (../node_modules/@nestjs/swagger/dist/explorers/api-parameters.explorer.js:78:27) at parameters.map.param (../node_modules/@nestjs/swagger/dist/explorers/api-parameters.explorer.js:190:35) at Array.map (<anonymous>) at mapModelsToDefinitons (../node_modules/@nestjs/swagger/dist/explorers/api-parameters.explorer.js:186:23) at exports.exploreApiParametersMetadata (../node_modules/@nestjs/swagger/dist/explorers/api-parameters.explorer.js:24:35) at explorers.reduce (../node_modules/@nestjs/swagger/dist/swagger-explorer.js:52:45) at Array.reduce (<anonymous>) at lodash_1.mapValues (../node_modules/@nestjs/swagger/dist/swagger-explorer.js:51:97) at ../node_modules/lodash/lodash.js:13400:38 at ../node_modules/lodash/lodash.js:4925:15 (node:22562) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:22562) [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.

Expected behavior

@ApiImplicitBody decorator should work.

Minimal reproduction of the problem with instructions

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

Environment


Nest Swagger version: 2.2.2

 
For Tooling issues:
- Node version: 9.4.0  
- Platform: Mac 

Others:

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
kamilmysliwieccommented, Aug 17, 2018

2.3.0 is available already

0reactions
lock[bot]commented, Apr 25, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nestjs/Swagger @ApiImplicitBody() not working - Stack Overflow
I have a @Post() route that I'm trying to get tested in swagger, but the request doesn't show any kind of data types...
Read more >
How to use the @nestjs/swagger.ApiImplicitQuery function in ...
let object = await this.contentTypeRepository.findOneOrFail(id); return plainToClass(OutContentTypeDto, object); } catch (error) { throw error; } } ...
Read more >
Introduction | ApiException - GitHub Pages
It uses message, error and status of all given HttpException and generates the correct responses in the OpenAPI Swagger documentation based on them....
Read more >
MongooseError('The `uri` parameter to `openUri()` must be a ...
Coding example for the question "MongooseError('The `uri` parameter to `openUri()` must be a ' +" error appears even though variable is a string-node.js....
Read more >
@nestjs/swagger - npm
@ApiImplicitParam is now @ApiParam; @ApiImplicitBody is now @ApiBody; @ApiImplicitHeader is now @ApiHeader; @ApiOperation({ title: ...
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