From d582c7a0f856c1a352992e3d16be319a891e0202 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 15 Aug 2020 17:23:09 -0400 Subject: JSON schema refactor (#731) * Remove JsonSchema.clone * Move createProxy function * Group public properties first * Create private version of getPropertySchema * Mark functions as private * Use non-static getValidValueOrDefault * Mark private * Make public validate function not take an info parameter * Remove JsonSchema * Add isValid function * Use isValid for some tests * Fix incorrect type --- ext/bg/js/dictionary-importer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ext/bg/js/dictionary-importer.js') diff --git a/ext/bg/js/dictionary-importer.js b/ext/bg/js/dictionary-importer.js index 4374ff40..535756f7 100644 --- a/ext/bg/js/dictionary-importer.js +++ b/ext/bg/js/dictionary-importer.js @@ -17,13 +17,14 @@ /* global * JSZip - * JsonSchema + * JsonSchemaValidator * mediaUtility */ class DictionaryImporter { constructor() { this._schemas = new Map(); + this._jsonSchemaValidator = new JsonSchemaValidator(); } async importDictionary(dictionaryDatabase, archiveSource, details, onProgress) { @@ -241,7 +242,7 @@ class DictionaryImporter { _validateJsonSchema(value, schema, fileName) { try { - JsonSchema.validate(value, schema); + this._jsonSchemaValidator.validate(value, schema); } catch (e) { throw this._formatSchemaError(e, fileName); } -- cgit v1.2.3