Skip to content

Commit df2a407

Browse files
author
Rich Adams
committed
Initial commit
1 parent 636c1ad commit df2a407

File tree

4 files changed

+185
-2
lines changed

4 files changed

+185
-2
lines changed

Diff for: LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Rich Adams ([email protected])
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

Diff for: README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
# typed-ajv
2-
Typings for npm ajv module
1+
# Typed ajv
2+
3+
The type definition for [`ajv`](https://github.com/epoberezkin/ajv).
4+
5+
## License
6+
7+
MIT

Diff for: ajv.d.ts

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

Diff for: tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs"
4+
},
5+
"files": [
6+
"ajv.d.ts"
7+
]
8+
}

0 commit comments

Comments
 (0)