[ ] 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.
Swagger spec is not correctly generated for a route with 1 path parameter.
Swagger UI should have a parameter description and input, instead it says No parameters.
https://github.com/miikaah/nestjs-repro
Nest version: 5.1.0
@nestjs/swagger version: 2.5.1
Had the same problem, the solution is to add type on param.
This works:
@Delete('/:id')
async deleteById(@Param('id', new ParseIntPipe()) id: number) {
return await this.projectOwnersService.deleteById(id);
}
This doesn't:
@Delete('/:id')
async deleteById(@Param('id', new ParseIntPipe()) id) {
return await this.projectOwnersService.deleteById(id);
}
Also facing the problems with generated spec.
"@nestjs/core": "5.7.3"
"@nestjs/swagger": "2.5.1"
Declaration:
@Delete(':storeId')
@ApiImplicitParam({ name: 'merchantId', type: String })
@ApiImplicitParam({ name: 'storeId', type: String })
async deleteStore(@Param(DefaultStoreByMerchantStoreIdPipe) defaultStore: DefaultStore): Promise<void> {
await this.defaultStoreService.remove(defaultStore);
}
Result:

Workaround (| any):
@Delete(':storeId')
@ApiImplicitParam({ name: 'merchantId', type: String })
@ApiImplicitParam({ name: 'storeId', type: String })
async deleteStore(@Param(DefaultStoreByMerchantStoreIdPipe) defaultStore: DefaultStore | any): Promise<void> {
await this.defaultStoreService.remove(defaultStore);
}
Result (which is expected):

It's reproducible only for
@Deleteaction.
the same
Fixed in the next version (to install run npm i @nestjs/swagger@next). Note: remember to update @nestjs/common, @nestjs/core and typescript as well to ensure that you're using the latest versions.
Steps to migrate: https://github.com/nestjs/swagger/pull/355#issuecomment-547925879
4.0.0 has been published
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.
Most helpful comment
Also facing the problems with generated spec.
Declaration:
Result:

Workaround (
| any):Result (which is expected):
