Migration guide

If you're currently using @nestjs/swagger@3.*, note the following breaking/API changes in version 4.0.

Breaking changes

The following decorators have been changed/renamed:

  • @ApiModelProperty is now @ApiProperty
  • @ApiModelPropertyOptional is now @ApiPropertyOptional
  • @ApiResponseModelProperty is now @ApiResponseProperty
  • @ApiImplicitQuery is now @ApiQuery
  • @ApiImplicitParam is now @ApiParam
  • @ApiImplicitBody is now @ApiBody
  • @ApiImplicitHeader is now @ApiHeader
  • @ApiOperation({{ '{' }} title: 'test' {{ '}' }}) is now @ApiOperation({{ '{' }} summary: 'test' {{ '}' }})
  • @ApiUseTags is now @ApiTags

DocumentBuilder breaking changes (updated method signatures):

  • addTag
  • addBearerAuth
  • addOAuth2
  • setContactEmail is now setContact
  • setHost has been removed
  • setSchemes has been removed (use the addServer instead, e.g., addServer('http://'))

New methods

The following methods have been added:

  • addServer
  • addApiKey
  • addBasicAuth
  • addSecurity
  • addSecurityRequirements