NestJS OpenApi Extended Decorators
Extended decorator functions for the @nestjs/swagger module
Installation
npm i @marxlnfcs/nest-swagger-decorators
Usage
Controller
@ApiController('/', {
tags: [ ... ],
tagGroups: [ ... ],
header: { ... },
params: { ... },
query: { ... },
})
export class AppController {}
@ApiController({
path: '/',
tags: [ ... ],
tagGroups: [ ... ],
header: { ... },
params: { ... },
query: { ... },
})
export class AppController {}
@ApiController('/', false)
export class AppController {}
Routes
@ApiController('/')
export class AppController {
@ApiGet('/', { ... })
@ApiGet({ path: '/', ... })
@ApiGet('/', false)
ping(){ ... }
}
Exceptions
@ApiController('/')
export class AppController {
@ApiGet('/')
@ApiNotFoundException()
@ApiUnauthorizedException()
ping(){ ... }
}
TagGroups
@ApiController('/')
@TagGroups(...)
export class AppController {
@ApiGet('/', { ... })
@ApiTagGroups(...)
ping(){ ... }
}
Retrieve TagGroups
import {getApiTagGroups} from "@marxlnfcs/nest-swagger-decorators";
const tagGroups = getApiTagGroups();