Search code examples
swaggernestjs

How to add a @nestjs/swagger controller description?


I cannot get a description on the controller.

Old version without using Nest: enter image description here

New version on Nest: enter image description here

enter image description here


Solution

  • You can use the DocumentBuilder#addTag option when setting up Swagger to document the tag:

    new DocumentBuilder()
      .addTag('auth', 'Auth endpoints description')
      .build();
    

    There is no option available afaik to add a description at the controller level. You can only add one or more tags at the controller level with @ApiTags.