Search code examples
swaggernestjs

How to add description to @ApiTags for swagger in NestJS?


I want to add desription for block of api.

I have tried:

@ApiOperation({
  description: 'Operation description'
})

It doesn't work.


Solution

  • Adding description on method level

    @ApiOperation({ summary: 'Operation description' })
    

    Check here: https://docs.nestjs.com/openapi/migration-guide#breaking-changes

    Adding tag on class level (controller)

    @ApiTags('MyTag')
    

    This will create a collapsible block with all methods underneath it.

    Check here: https://docs.nestjs.com/openapi/decorators