correct TypeScript definitions

master
Evgeny Poberezkin 2016-04-17 19:37:40 +01:00
parent de23630ea1
commit 6a2c8633cb
2 changed files with 27 additions and 24 deletions

View File

@ -737,7 +737,7 @@ Although `addSchema` does not compile schemas, explicit compilation is not requi
By default the schema is validated against meta-schema before it is added, and if the schema does not pass validation the exception is thrown. This behaviour is controlled by `validateSchema` option. By default the schema is validated against meta-schema before it is added, and if the schema does not pass validation the exception is thrown. This behaviour is controlled by `validateSchema` option.
##### .addMetaSchema(Array<Object>Object schema [, String key]) ##### .addMetaSchema(Array<Object>|Object schema [, String key])
Adds meta schema(s) that can be used to validate other schemas. That function should be used instead of `addSchema` because there may be instance options that would compile a meta schema incorrectly (at the moment it is `removeAdditional` option). Adds meta schema(s) that can be used to validate other schemas. That function should be used instead of `addSchema` because there may be instance options that would compile a meta schema incorrectly (at the moment it is `removeAdditional` option).

49
lib/ajv.d.ts vendored
View File

@ -9,10 +9,10 @@ declare namespace ajv {
addMetaSchema(schema: Object, key?: string): void; addMetaSchema(schema: Object, key?: string): void;
validateSchema(schema: Object): boolean; validateSchema(schema: Object): boolean;
getSchema(key: string): ValidateFunction; getSchema(key: string): ValidateFunction;
removeSchema(schema: Object|string); removeSchema(schema: Object|string|RegExp);
addFormat(name: string, format: RegExp|Function|Object|string): void; addFormat(name: string, format: string|RegExp|Function|Object): void;
addKeyword(keyword: string, definition: Object): void; addKeyword(keyword: string, definition: Object): void;
errorsText(errors?: Array<Object>, options?: Object); errorsText(errors?: Array<ErrorObject>, options?: ErrorsTextOptions);
} }
interface ValidateFunction { interface ValidateFunction {
@ -21,33 +21,36 @@ declare namespace ajv {
} }
interface Options { interface Options {
v5?: boolean;
allErrors?: boolean; allErrors?: boolean;
removeAdditional?: boolean;
useDefaults?: boolean;
coerceTypes?: boolean;
verbose?: boolean; verbose?: boolean;
format?: string; jsonPointers?: boolean;
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; uniqueItems?: boolean;
unicode?: boolean; unicode?: boolean;
beautify?: boolean; format?: string;
cache?: any; formats?: Object;
schemas?: Array<Object> | Object;
missingRefs?: boolean | string;
loadSchema?: (uri, cb: (err, schema) => any) => any;
removeAdditional?: boolean | string;
useDefaults?: boolean | string;
coerceTypes?: boolean;
async?: boolean | string;
transpile?: string | (code: string) => string;
meta?: boolean | Object;
validateSchema?: boolean | string;
addUsedSchema?: boolean;
inlineRefs?: boolean | number;
passContext?: boolean;
loopRequired?: number;
multipleOfPrecision?: number;
errorDataPath?: string; errorDataPath?: string;
jsonPointers?: boolean;
messages?: boolean; messages?: boolean;
v5?: boolean; beautify?: boolean | Object;
cache?: Object;
} }
interface ErrorsOptions { interface ErrorsTextOptions {
separator?: string; separator?: string;
dataVar?: string; dataVar?: string;
} }
@ -62,7 +65,7 @@ declare namespace ajv {
// These are added with the `verbose` option. // These are added with the `verbose` option.
schema?: Object; schema?: Object;
parentSchema?: Object; parentSchema?: Object;
data?: Object; data?: any;
} }
interface ErrorParameters { interface ErrorParameters {