UNPKG

1.09 kBTypeScriptView Raw
1import { ValidatorOptions } from 'class-validator';
2import { ClassTransformOptions } from 'class-transformer';
3/**
4 * Body decorator parameters.
5 */
6export interface BodyOptions {
7 /**
8 * If set to true then request body will become required.
9 * If user performs a request and body is not in a request then routing-controllers will throw an error.
10 */
11 required?: boolean;
12 /**
13 * Class-transformer options used to perform plainToClass operation.
14 *
15 * @see https://github.com/pleerock/class-transformer
16 */
17 transform?: ClassTransformOptions;
18 /**
19 * If true, class-validator will be used to validate param object.
20 * If validation options are given then class-validator will perform validation with given options.
21 *
22 * @see https://github.com/pleerock/class-validator
23 */
24 validate?: boolean | ValidatorOptions;
25 /**
26 * Extra options to be passed to body-parser middleware.
27 */
28 options?: any;
29 /**
30 * Explicitly set type which should be used for Body to perform transformation.
31 */
32 type?: any;
33}