@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
43 lines (31 loc) • 1.16 kB
Markdown
lang: en
title: 'API docs: openapi-v3.requestbody.array'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/openapi-v3
permalink: /doc/en/lb4/apidocs.openapi-v3.requestbody.array.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/openapi-v3](./openapi-v3.md) > [requestBody](./openapi-v3.requestbody.md) > [array](./openapi-v3.requestbody.array.md)
## requestBody.array variable
Define a requestBody of `array` type.
<b>Signature:</b>
```typescript
array: (itemSpec: SchemaObject | ReferenceObject, properties?: {
description?: string | undefined;
required?: boolean | undefined;
} | undefined) => (target: object, member: string, index: number) => void
```
## Example
```ts
export class MyController {
@post('/greet')
greet(@requestBody.array(
{schema: {type: 'string'}},
{description: 'an array of names', required: false}
) names: string[]): string {
return `Hello, ${names}`;
}
}
```