swagger
swagger copied to clipboard
Using @Req, @Res on NestJs controller kills swagger document creation
Bug Report
Using @Req, @Res on NestJs platform-express controller kills swagger document creation
Current behavior
While using @Req/@Res in controller makes module initialization failed. The swagger page is not coming up. By removing these @Res from controller makes the code working fine.
Input Code
@Get('/contacts')
@ApiOperation({ title: 'Get contacts details' })
@ApiResponse({ status: 200, description: 'Success' })
@ApiResponse({ status: 400, description: 'Forbidden.' })
@ApiResponse({ status: 403, description: 'Bad request or Invalid Input' })
@ApiResponse({ status: 500, description: 'Internal server error' })
@ApiImplicitHeader({ name: 'authorization', description: 'authorization' })
public getContacts(@Res() res: Response) {
return res.status(200).send("contact");
}
Expected behavior
This should work fine without any issues. Need a fix or workaround to resolve this issue.
Possible Solution
Environment
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/platform-express": "6.5.3",
"@nestjs/swagger": "3.1.0",
"ts-node": "8.3.0", "typescript": "3.5.3"
Nest version: 6.5.3
For Tooling issues:
- Node version: v8.12.0
- Platform: Windows
Others:
Please, provide a minimal repository which reproduces your 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.