-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathajv.d.ts
149 lines (131 loc) · 4 KB
/
ajv.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// Type definitions for ajv v3.5.0
// Project: https://github.com/epoberezkin/ajv
// Original Definitions by: Rich Adams <https://github.com/enriched>
declare namespace ajv {
interface AjvStatic {
new (options?: AjvOptions): AjvInstance;
}
interface AjvInstance {
compile(schema: Object): ValidationFunction;
compileAsync(schema: Object, cb: (err: any, validate: ValidationFunction) => any): void;
validate(schema: Object|string, data: any): boolean;
addSchema(schema: Array<Object>|Object, key?: string): void;
addMetaSchema(schema: Object, key?: string): void;
validateSchema(schema: Object): boolean;
getSchema(key: string): ValidationFunction;
removeSchema(schema: Object|string);
addFormat(name: string, format: RegExp|Function|Object|string): void;
addKeyword(keyword: string, definition: Object): void;
errorsText(errors?: Array<Object>, options?: Object);
}
interface ValidationFunction {
(data: Object|string): boolean;
errors?: Array<ErrorObject>;
}
interface AjvOptions {
allErrors?: boolean;
removeAdditional?: boolean;
useDefaults?: boolean;
coerceTypes?: boolean;
verbose?: boolean;
format?: string;
formats?: Object;
schemas?: Object;
meta?: boolean;
validateSchema?: boolean;
addUsedSchema?: boolean;
inlineRefs?: boolean;
loopRequired?: number;
multipleOfPrecision?: boolean;
missingRefs?: boolean;
loadSchema?: (uri, cb: (err, schema) => any) => any;
uniqueItems?: boolean;
unicode?: boolean;
beautify?: boolean;
cache?: any;
errorDataPath?: string;
jsonPointers?: boolean;
messages?: boolean;
v5?: boolean;
}
interface ErrorsOptions {
separator?: string;
dataVar?: string;
}
interface ErrorObject {
keyword: string;
dataPath: string;
schemaPath: string;
params: ErrorParameters;
// Excluded if messages set to false
message?: string;
// These added with verbose option
schema?: Object;
parentSchema?: Object;
data: Object;
}
interface ErrorParameters {
maxItems?: MinMaxParam;
minItems?: MinMaxParam;
maxLength?: MinMaxParam;
minLength?: MinMaxParam;
maxProperties?: MinMaxParam;
minProperties?: MinMaxParam;
additionalItems?: MinMaxParam;
additionalProperties: AdditionalPropertyParam;
patternGroups: PatternGroup[];
dependencies: Dependency[];
format: Object;
maximum: MaximumMinimumParam;
minimum: MaximumMinimumParam;
multipleOf: MultipleOfParam;
pattern: PatternParam;
required: RequiredParam;
type: TypeParam;
uniqueItems: UniqueItemsParam;
$ref: RefParam;
}
interface MinMaxParam {
limit: number;
}
interface AdditionalPropertyParam {
additionalProperty: string;
}
interface PatternGroup {
pattern: string;
reason: string;
limit: number;
}
interface Dependency {
property: string;
missingProperty: string;
deps: string;
depsCount: number;
}
interface MaximumMinimumParam {
limit: number;
exclusive: boolean;
comparison: string;
}
interface MultipleOfParam {
multipleOf: Object;
}
interface PatternParam {
pattern: Object;
}
interface RequiredParam {
missingProperty: string;
}
interface TypeParam {
type: string;
}
interface UniqueItemsParam {
i: number;
j: number;
}
interface RefParam {
ref: string;
}
}
declare var ajv: ajv.AjvStatic;
export = ajv;