UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

50 lines (34 loc) 2.06 kB
--- 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) &gt; [@loopback/metadata](./metadata.md) &gt; [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: <b>Signature:</b> ```typescript export declare class MethodMultiDecoratorFactory<T> extends MethodDecoratorFactory<T[]> ``` <b>Extends:</b> [MethodDecoratorFactory](./metadata.methoddecoratorfactory.md)<!-- -->&lt;T\[\]&gt; ## 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 | Method | Modifiers | Description | | --- | --- | --- | | [mergeWithInherited(inheritedMetadata, target, methodName)](./metadata.methodmultidecoratorfactory.mergewithinherited.md) | | | | [mergeWithOwn(ownMetadata, target, methodName, methodDescriptor)](./metadata.methodmultidecoratorfactory.mergewithown.md) | | |