# Decorator ReturnsArray

Decorator swagger operation response deprecated
Module
import { ReturnsArray } from "@tsed/common"
Source/packages/common/src/mvc/decorators/method/returnType.ts

# Overview

function ReturnsArray(statusCode: number, options: Partial<ReturnTypeOptions>): ReturnsChainedDecorators;

export function ReturnsArray(statusCode: number, model: Type<any>): ReturnsChainedDecorators;

export function ReturnsArray(options: Partial<ReturnTypeOptions>): ReturnsChainedDecorators;

export function ReturnsArray(model: Type<any>): ReturnsChainedDecorators;

export function ReturnsArray(model: Type<any>, options: Partial<ReturnTypeOptions>): ReturnsChainedDecorators;

Param Type Description
statusCode number Code status options

# Description

Add responses documentation for a specific status code.

WARNING

This decorator will be removed in v6 in favor of Returns from @tsed/schema. For v5 user, use ReturnsArray decorator from @tsed/common then in v6 switch to @Returns(Array).Of(User) from @tsed/schema.

# Examples

# With status code

import {ReturnsArray} from "@tsed/common";
import {Returns} from "@tsed/schema";

@Controller("/")
class MyController {
  @ReturnsArray(200, Model) // deprecated
  async myMethod(): Promise<Model> {}

  @Returns(200, Array).Of(Model).Description('description')
  async myMethod(): Promise<Model> {}
}
1
2
3
4
5
6
7
8
9
10
11

Other topics