@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
91 lines (50 loc) • 2.34 kB
Markdown
---
lang: en
title: 'API docs: metadata.methodmultidecoratorfactory'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/metadata
permalink: /doc/en/lb4/apidocs.metadata.methodmultidecoratorfactory.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/metadata](./metadata.md) > [MethodMultiDecoratorFactory](./metadata.methodmultidecoratorfactory.md)
## MethodMultiDecoratorFactory class
Factory for an append-array of method-level decorators The `@response` metadata for a method is an array. Each item in the array should be a single value, containing a response code and a single spec or Model. This should allow:
**Signature:**
```typescript
export declare class MethodMultiDecoratorFactory<T> extends MethodDecoratorFactory<T[]>
```
**Extends:** [MethodDecoratorFactory](./metadata.methoddecoratorfactory.md)<!-- --><T\[\]>
## Example
```ts
@response(200, MyFirstModel)
@response(403, [NotAuthorizedReasonOne, NotAuthorizedReasonTwo])
@response(404, NotFoundOne)
@response(404, NotFoundTwo)
@response(409, {schema: {}})
public async myMethod() {}
```
In the case that a ResponseObject is passed, it becomes the default for description/content, and if possible, further Models are incorporated as a `oneOf: []` array.
In the case that a ReferenceObject is passed, it and it alone is used, since references can be external and we cannot `oneOf` their content.
The factory creates and updates an array of items T\[\], and the getter provides the values as that array.
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
[mergeWithInherited(inheritedMetadata, target, methodName)](./metadata.methodmultidecoratorfactory.mergewithinherited.md)
</td><td markdown="1">
`protected`
</td><td markdown="1">
</td></tr>
<tr><td markdown="1">
[mergeWithOwn(ownMetadata, target, methodName, methodDescriptor)](./metadata.methodmultidecoratorfactory.mergewithown.md)
</td><td markdown="1">
`protected`
</td><td markdown="1">
</td></tr>
</tbody></table>