Question · NestJS course · Module 11: Swagger and OpenAPI

Array Type in Response

How do you indicate in the @ApiOkResponse decorator that the response is an array of DTO objects?

Answer options

  • type: [LegionDto]
  • type: LegionDto, isArray: true
  • type: Array<LegionDto>
  • Both type: [LegionDto] and isArray: true work correctly

You can check the correct answer by solving this task in the CodeWorlds game.