UNPKG

1.3 kBTypeScriptView Raw
1/**
2 * Validation error description.
3 */
4export declare class ValidationError {
5 /**
6 * Object that was validated.
7 *
8 * OPTIONAL - configurable via the ValidatorOptions.validationError.target option
9 */
10 target?: object;
11 /**
12 * Object's property that haven't pass validation.
13 */
14 property: string;
15 /**
16 * Value that haven't pass a validation.
17 *
18 * OPTIONAL - configurable via the ValidatorOptions.validationError.value option
19 */
20 value?: any;
21 /**
22 * Constraints that failed validation with error messages.
23 */
24 constraints?: {
25 [type: string]: string;
26 };
27 /**
28 * Contains all nested validation errors of the property.
29 */
30 children?: ValidationError[];
31 contexts?: {
32 [type: string]: any;
33 };
34 /**
35 *
36 * @param shouldDecorate decorate the message with ANSI formatter escape codes for better readability
37 * @param hasParent true when the error is a child of an another one
38 * @param parentPath path as string to the parent of this property
39 * @param showConstraintMessages show constraint messages instead of constraint names
40 */
41 toString(shouldDecorate?: boolean, hasParent?: boolean, parentPath?: string, showConstraintMessages?: boolean): string;
42}