From d16739a83a20e1729e08dbcbbc155be15972d146 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 22 May 2021 15:45:20 -0400 Subject: Json schema validation improvements (#1697) * Create new JsonSchema class * Add proxy handler * Update tests * Update validation scripts * Update backend * Update audio downloader * Update options util * Update dictionary importer * Update json schema file reference * Remove old json-schema.js * Rename new json-schema.js * Update file names * Rename class --- ext/js/background/profile-conditions-util.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'ext/js/background/profile-conditions-util.js') diff --git a/ext/js/background/profile-conditions-util.js b/ext/js/background/profile-conditions-util.js index dcd60796..2de25420 100644 --- a/ext/js/background/profile-conditions-util.js +++ b/ext/js/background/profile-conditions-util.js @@ -15,6 +15,10 @@ * along with this program. If not, see . */ +/* global + * JsonSchema + */ + /** * Utility class to help processing profile conditions. */ @@ -109,11 +113,13 @@ class ProfileConditionsUtil { default: anyOf.push({allOf}); break; } } + let schema; switch (anyOf.length) { - case 0: return {}; - case 1: return anyOf[0]; - default: return {anyOf}; + case 0: schema = {}; break; + case 1: schema = anyOf[0]; break; + default: schema = {anyOf}; break; } + return new JsonSchema(schema); } /** -- cgit v1.2.3