1 |
|
2 | import { IValidationRule } from './IValidationRule';
|
3 | import { ValidationResult } from './ValidationResult';
|
4 | import { Schema } from './Schema';
|
5 | import { PropertySchema } from './PropertySchema';
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | export declare class ObjectSchema extends Schema {
|
22 | private _properties;
|
23 | private _allowUndefined;
|
24 | |
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | constructor(allowUndefined?: boolean, required?: boolean, rules?: IValidationRule[]);
|
34 | /**
|
35 | * Gets validation schemas for object properties.
|
36 | *
|
37 | * @returns the list of property validation schemas.
|
38 | *
|
39 | * @see [[PropertySchema]]
|
40 | */
|
41 | getProperties(): PropertySchema[];
|
42 | /**
|
43 | * Sets validation schemas for object properties.
|
44 | *
|
45 | * @param value a list of property validation schemas.
|
46 | *
|
47 | * @see [[PropertySchema]]
|
48 | */
|
49 | setProperties(value: PropertySchema[]): void;
|
50 | /**
|
51 | * Gets flag to allow undefined properties
|
52 | *
|
53 | * @returns true to allow undefined properties and false to disallow.
|
54 | */
|
55 | /**
|
56 | * Sets flag to allow undefined properties
|
57 | *
|
58 | * @param value true to allow undefined properties and false to disallow.
|
59 | */
|
60 | isUndefinedAllowed: boolean;
|
61 | /**
|
62 | * Sets flag to allow undefined properties
|
63 | *
|
64 | * This method returns reference to this exception to implement Builder pattern
|
65 | * to chain additional calls.
|
66 | *
|
67 | * @param value true to allow undefined properties and false to disallow.
|
68 | * @returns this validation schema.
|
69 | */
|
70 | allowUndefined(value: boolean): ObjectSchema;
|
71 | /**
|
72 | * Adds a validation schema for an object property.
|
73 | *
|
74 | * This method returns reference to this exception to implement Builder pattern
|
75 | * to chain additional calls.
|
76 | *
|
77 | * @param schema a property validation schema to be added.
|
78 | * @returns this validation schema.
|
79 | *
|
80 | * @see [[PropertySchema]]
|
81 | */
|
82 | withProperty(schema: PropertySchema): ObjectSchema;
|
83 | /**
|
84 | * Adds a validation schema for a required object property.
|
85 | *
|
86 | * @param name a property name.
|
87 | * @param type (optional) a property schema or type.
|
88 | * @param rules (optional) a list of property validation rules.
|
89 | */
|
90 | withRequiredProperty(name: string, type?: any, ...rules: IValidationRule[]): ObjectSchema;
|
91 | /**
|
92 | * Adds a validation schema for an optional object property.
|
93 | *
|
94 | * @param name a property name.
|
95 | * @param type (optional) a property schema or type.
|
96 | * @param rules (optional) a list of property validation rules.
|
97 | */
|
98 | withOptionalProperty(name: string, type?: any, ...rules: IValidationRule[]): ObjectSchema;
|
99 | /**
|
100 | * Validates a given value against the schema and configured validation rules.
|
101 | *
|
102 | * @param path a dot notation path to the value.
|
103 | * @param value a value to be validated.
|
104 | * @param results a list with validation results to add new results.
|
105 | */
|
106 | protected performValidation(path: string, value: any, results: ValidationResult[]): void;
|
107 | }
|