UNPKG

2.01 kBTypeScriptView Raw
1/** @module validate */
2import { ValidationResultType } from './ValidationResultType';
3/**
4 * Result generated by schema validation
5 */
6export declare class ValidationResult {
7 private _path;
8 private _type;
9 private _code;
10 private _message;
11 private _expected;
12 private _actual;
13 /**
14 * Creates a new instance of validation ressult and sets its values.
15 *
16 * @param path a dot notation path of the validated element.
17 * @param type a type of the validation result: Information, Warning, or Error.
18 * @param code an error code.
19 * @param message a human readable message.
20 * @param expected an value expected by schema validation.
21 * @param actual an actual value found by schema validation.
22 *
23 * @see [[ValidationResultType]]
24 */
25 constructor(path?: string, type?: ValidationResultType, code?: string, message?: string, expected?: any, actual?: any);
26 /**
27 * Gets dot notation path of the validated element.
28 *
29 * @returns the path of the validated element.
30 */
31 getPath(): string;
32 /**
33 * Gets the type of the validation result: Information, Warning, or Error.
34 *
35 * @returns the type of the validation result.
36 *
37 * @see [[ValidationResultType]]
38 */
39 getType(): ValidationResultType;
40 /**
41 * Gets the error code.
42 *
43 * @returns the error code
44 */
45 getCode(): string;
46 /**
47 * Gets the human readable message.
48 *
49 * @returns the result message.
50 */
51 getMessage(): string;
52 /**
53 * Gets the value expected by schema validation.
54 *
55 * @returns the expected value.
56 */
57 getExpected(): any;
58 /**
59 * Gets the actual value found by schema validation.
60 *
61 * @returns the actual value.
62 */
63 getActual(): any;
64 toJSON(): {
65 path: string;
66 type: ValidationResultType;
67 code: string;
68 message: string;
69 expected: any;
70 actual: any;
71 };
72}