NestJS - How do I expose param in Swagger

Viewed 1498

I am using NestJs. I have this controller:

@Get(':id')
  @ApiOperation({ summary: 'Get action by id' }) 
  findById(@Param('id') id: string, @Query() query?: SelectQuery & PopulateQuery): Promise<Action> {
    return this.actionService.findById(id, query);
  }

When I open the page in Swagger, it says there are no parameters available.

In the Swagger, how can I make the param 'id' as an input box, so I can use it in the Swagger (browser)?

Thank you.

1 Answers

Moments after I posted the question, I found the answer. It is simple. Just add the following.

@ApiParam({
    name: 'id',
    description: 'Gets the Action id',
  })
Related