File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 1+ import { ApiProperty } from '@nestjs/swagger'
2+
3+ export class AppInfoDto {
4+ @ApiProperty ( )
5+ public name : string
6+
7+ @ApiProperty ( )
8+ public version : string
9+ }
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ import { AppService } from './app.service'
44import { Response } from 'express'
55import { Public } from './_common/decorators/public.decorator'
66import { ShutdownService } from '~/shutdown.service'
7+ import { ApiOkResponse } from '@nestjs/swagger/dist/decorators/api-response.decorator'
8+ import { ApiExtraModels , ApiHideProperty , getSchemaPath } from '@nestjs/swagger'
9+ import { AppInfoDto } from '~/_dto/app.dto'
710
811@Public ( )
912@Controller ( )
@@ -13,6 +16,13 @@ export class AppController extends AbstractController {
1316 }
1417
1518 @Get ( )
19+ @ApiExtraModels ( AppInfoDto )
20+ @ApiOkResponse ( {
21+ description : 'Returns the infos of the application' ,
22+ schema : {
23+ $ref : getSchemaPath ( AppInfoDto ) ,
24+ } ,
25+ } )
1626 public root ( @Res ( ) res : Response ) : Response {
1727 return res . json ( this . _service . getInfos ( ) )
1828 }
You can’t perform that action at this time.
0 commit comments