UNPKG

1.41 kBTypeScriptView Raw
1import { ValidationMetadataArgs } from './ValidationMetadataArgs';
2import { ValidationArguments } from '../validation/ValidationArguments';
3/**
4 * This metadata contains validation rules.
5 */
6export declare class ValidationMetadata {
7 /**
8 * Validation type.
9 */
10 type: string;
11 /**
12 * Validator name.
13 */
14 name?: string;
15 /**
16 * Target class to which this validation is applied.
17 */
18 target: Function | string;
19 /**
20 * Property of the object to be validated.
21 */
22 propertyName: string;
23 /**
24 * Constraint class that performs validation. Used only for custom validations.
25 */
26 constraintCls: Function;
27 /**
28 * Array of constraints of this validation.
29 */
30 constraints: any[];
31 /**
32 * Validation message to be shown in the case of error.
33 */
34 message: string | ((args: ValidationArguments) => string);
35 /**
36 * Validation groups used for this validation.
37 */
38 groups: string[];
39 /**
40 * Indicates if validation must be performed always, no matter of validation groups used.
41 */
42 always?: boolean;
43 /**
44 * Specifies if validated value is an array and each of its item must be validated.
45 */
46 each: boolean;
47 context?: any;
48 /**
49 * Extra options specific to validation type.
50 */
51 validationTypeOptions: any;
52 constructor(args: ValidationMetadataArgs);
53}
54
\No newline at end of file