Page Contents

Home > @loopback/metadata > MethodMultiDecoratorFactory

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:

export declare class MethodMultiDecoratorFactory<T> extends MethodDecoratorFactory<T[]> 

Extends: MethodDecoratorFactory<T[]>

Example

 @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) protected  
mergeWithOwn(ownMetadata, target, methodName, methodDescriptor) protected