0

Il wrote a nestjs controller whith decorator

@Controller('sample')
export class SampleController {
  @Get(`/sample}`)
  @ApiOperation({
    description: 'sample controller',
    summary: 'sample',
  })
  @ApiOkResponse({
    description: 'sample list',
    type: String,
    isArray: true,
  })
  @ApiSecurity({ roles: ['read'] })
  async getSampleList(): Promise<string[]> {
    return ['sample1', 'sample2'];
  }
}

the file swagger-spec.yaml generated contains correct information according to decorator @ApiSecurity :

security:
        - *ref_14
        - roles:
            - read

but the swagger ui (http://127.0.0.1:3000/swagger/#/default/SampleController_getSampleList) doesn't refer to this information ???

screen capture

nest version : 8.2.5

@nestjs/swagger version : 5.2.1

tonio
  • 1
  • 1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 20 '22 at 14:06
  • I have added a complete sample to expose my problem, hopping it will be more comprehensive. – tonio May 23 '22 at 07:40

0 Answers0