UNPKG

826 BTypeScriptView Raw
1import { Action } from './Action';
2/**
3 * Used to register custom parameter handler in the controller action parameters.
4 */
5export interface CustomParameterDecorator {
6 /**
7 * Indicates if this parameter is required or not.
8 * If parameter is required and value provided by it is not set then routing-controllers will throw an error.
9 */
10 required?: boolean;
11 /**
12 * Factory function that returns value to be written to this parameter.
13 * In function it provides you Action object which contains current request, response, context objects.
14 * It also provides you original value of this parameter.
15 * It can return promise, and if it returns promise then promise will be resolved before calling controller action.
16 */
17 value: (action: Action, value?: any) => Promise<any> | any;
18}