From e8377d3d50a4d814a8d5193473a526226d0caf12 Mon Sep 17 00:00:00 2001 From: Dhananjay Balan Date: Thu, 26 May 2016 19:15:38 +0530 Subject: [PATCH] Improve z-schema.d.ts (#9427) - add `validateSchema` function to the definitions. --- z-schema/z-schema-tests.ts | 1 + z-schema/z-schema.d.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/z-schema/z-schema-tests.ts b/z-schema/z-schema-tests.ts index 90fdc4cd32..4dc96a0428 100644 --- a/z-schema/z-schema-tests.ts +++ b/z-schema/z-schema-tests.ts @@ -21,6 +21,7 @@ var schema: any = { }, }; +validator.validateSchema(schema); validator.validate(json, schema); validator.validate(json, schema, function (err: any, valid: boolean) { if (err) { diff --git a/z-schema/z-schema.d.ts b/z-schema/z-schema.d.ts index 83f43bc064..750abd2870 100644 --- a/z-schema/z-schema.d.ts +++ b/z-schema/z-schema.d.ts @@ -39,6 +39,12 @@ declare namespace ZSchema { export class Validator { constructor(options: Options); + /** + * @param schema - JSON object representing schema + * @returns {boolean} true if schema is valid. + */ + validateSchema(schema: any): boolean; + /** * @param json - either a JSON string or a parsed JSON object * @param schema - the JSON object representing the schema