diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-12-10 21:51:33 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-12-10 21:51:33 +0100 |
commit | 0469abd4a9c9270a1fdc962969e36e63699af8b4 (patch) | |
tree | f9864d4a4148621378958794cbbfdc2393733283 /node_modules/ajv/lib/ajv.d.ts | |
parent | 6947e79bbc258f7bc96af424ddb71a511f0c15a3 (diff) |
upgrade dependencies
Diffstat (limited to 'node_modules/ajv/lib/ajv.d.ts')
-rw-r--r-- | node_modules/ajv/lib/ajv.d.ts | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/node_modules/ajv/lib/ajv.d.ts b/node_modules/ajv/lib/ajv.d.ts index 1b5bd8188..b687f7814 100644 --- a/node_modules/ajv/lib/ajv.d.ts +++ b/node_modules/ajv/lib/ajv.d.ts @@ -1,13 +1,16 @@ declare var ajv: { (options?: ajv.Options): ajv.Ajv; new (options?: ajv.Options): ajv.Ajv; + ValidationError: ValidationError; + MissingRefError: MissingRefError; + $dataMetaSchema: Object; } declare namespace ajv { interface Ajv { /** * Validate data using schema - * Schema will be compiled and cached (using serialized JSON as key, [json-stable-stringify](https://github.com/substack/json-stable-stringify) is used to serialize by default). + * Schema will be compiled and cached (using serialized JSON as key, [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize by default). * @param {String|Object|Boolean} schemaKeyRef key, ref or schema object * @param {Any} data to be validated * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`). @@ -33,15 +36,17 @@ declare namespace ajv { * Adds schema to the instance. * @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored. * @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + * @return {Ajv} this for method chaining */ - addSchema(schema: Array<Object> | Object, key?: string): void; + addSchema(schema: Array<Object> | Object, key?: string): Ajv; /** * Add schema that will be used to validate other schemas * options in META_IGNORE_OPTIONS are alway set to false * @param {Object} schema schema object * @param {String} key optional schema key + * @return {Ajv} this for method chaining */ - addMetaSchema(schema: Object, key?: string): void; + addMetaSchema(schema: Object, key?: string): Ajv; /** * Validate schema * @param {Object|Boolean} schema schema to validate @@ -60,21 +65,24 @@ declare namespace ajv { * If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. * Even if schema is referenced by other schemas it still can be removed as other schemas have local references. * @param {String|Object|RegExp|Boolean} schemaKeyRef key, ref, pattern to match key/ref or schema object + * @return {Ajv} this for method chaining */ - removeSchema(schemaKeyRef?: Object | string | RegExp | boolean): void; + removeSchema(schemaKeyRef?: Object | string | RegExp | boolean): Ajv; /** * Add custom format * @param {String} name format name * @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid) + * @return {Ajv} this for method chaining */ - addFormat(name: string, format: FormatValidator | FormatDefinition): void; + addFormat(name: string, format: FormatValidator | FormatDefinition): Ajv; /** * Define custom keyword * @this Ajv * @param {String} keyword custom keyword, should be a valid identifier, should be different from all standard, custom and macro keywords. * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. + * @return {Ajv} this for method chaining */ - addKeyword(keyword: string, definition: KeywordDefinition): void; + addKeyword(keyword: string, definition: KeywordDefinition): Ajv; /** * Get keyword definition * @this Ajv @@ -86,8 +94,9 @@ declare namespace ajv { * Remove keyword * @this Ajv * @param {String} keyword pre-defined or custom keyword. + * @return {Ajv} this for method chaining */ - removeKeyword(keyword: string): void; + removeKeyword(keyword: string): Ajv; /** * Convert array of error message objects to string * @param {Array<Object>} errors optional array of validation errors, if not passed errors from the instance are used. @@ -110,8 +119,13 @@ declare namespace ajv { parentDataProperty?: string | number, rootData?: Object | Array<any> ): boolean | Thenable<any>; - errors?: Array<ErrorObject>; schema?: Object | boolean; + errors?: null | Array<ErrorObject>; + refs?: Object; + refVal?: Array<any>; + root?: ValidateFunction | Object; + $async?: true; + source?: Object; } interface Options { @@ -149,7 +163,7 @@ declare namespace ajv { cache?: Object; } - type FormatValidator = string | RegExp | ((data: string) => boolean); + type FormatValidator = string | RegExp | ((data: string) => boolean | Thenable<any>); interface FormatDefinition { validate: FormatValidator; @@ -293,4 +307,22 @@ declare namespace ajv { } } +declare class ValidationError extends Error { + constructor(errors: Array<ajv.ErrorObject>); + + message: string; + errors: Array<ajv.ErrorObject>; + ajv: true; + validation: true; +} + +declare class MissingRefError extends Error { + constructor(baseId: string, ref: string, message?: string); + static message: (baseId: string, ref: string) => string; + + message: string; + missingRef: string; + missingSchema: string; +} + export = ajv; |