1

I am writing a REST API swagger in Nest JS.

My code snippet looks like this:

  @Get()
  @ApiOperation({
    summary: `Something`,
    description: `Something`,
  })
  @ApiOkResponse({
    description: 'The resources were returned successfully',
    type: VpcV1,
    isArray: true
  })
  @ApiForbiddenResponse({ description: 'Unauthorized Request' })
  list() {
    return this.service.list();
  }

As you can see the the this.service.list() is returning ab object of type VpcV1.

I have added it as type in the @ApiOkResponse().

But as the VpcV1 is from third party package which I do not have any control, it's not a DTO. In such a case how can I see the API response object such that when user will see the swagger, they can be able to see the Response Schema properly?

Pradip
  • 509
  • 1
  • 5
  • 22

0 Answers0