UNPKG

1.15 kBTypeScriptView Raw
1import { ValidatorOptions } from 'class-validator';
2import { ClassTransformOptions } from 'class-transformer';
3/**
4 * Extra options set to the parameter decorators.
5 */
6export interface ParamOptions {
7 /**
8 * If set to true then parameter will be required.
9 * If user performs a request and required parameter is not in a request then routing-controllers will throw an error.
10 */
11 required?: boolean;
12 /**
13 * If set to true then parameter will be parsed to json.
14 * Parsing is automatically done if parameter type is a class type.
15 */
16 parse?: boolean;
17 /**
18 * Class transform options used to perform plainToClass operation.
19 */
20 transform?: ClassTransformOptions;
21 /**
22 * If true, class-validator will be used to validate param object.
23 * If validation options are given then class-validator will perform validation with given options.
24 */
25 validate?: boolean | ValidatorOptions;
26 /**
27 * Explicitly set type which should be used for param to perform transformation.
28 */
29 type?: any;
30 /**
31 * Force value to be cast as an array.
32 */
33 isArray?: boolean;
34}