Page Contents

Home > @loopback/openapi-v3 > param > array

param.array() function

Define a parameter of array type.

Signature:

array: (name: string, source: ParameterLocation, itemSpec: SchemaObject | ReferenceObject) => (target: object, member: string, index: number) => void

Parameters

Parameter Type Description
name string Parameter name
source ParameterLocation Source of the parameter value
itemSpec SchemaObject | ReferenceObject Item type for the array or the full item object

Returns:

(target: object, member: string, index: number) => void

Example

export class MyController {
  @get('/greet')
  greet(@param.array('names', 'query', {type: 'string'}) names: string[]): string {
    return `Hello, ${names}`;
  }
}