diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-01-26 15:45:31 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-02-02 10:12:01 -0500 |
commit | a844698f153773d5255724ba48a00851418af009 (patch) | |
tree | fc983665926147d4b4886adf8584f3376e9a4576 /ext/bg/js | |
parent | 203216986e82d8b6c654979791d1ff5172ba83ca (diff) |
Return unconstrained schema when additionalProperties is true/undefined
Diffstat (limited to 'ext/bg/js')
-rw-r--r-- | ext/bg/js/json-schema.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/bg/js/json-schema.js b/ext/bg/js/json-schema.js index ab4a4817..7a7f2489 100644 --- a/ext/bg/js/json-schema.js +++ b/ext/bg/js/json-schema.js @@ -138,7 +138,13 @@ class JsonSchemaProxyHandler { } const additionalProperties = schema.additionalProperties; - return JsonSchemaProxyHandler.isObject(additionalProperties) ? additionalProperties : null; + if (additionalProperties === false) { + return null; + } if (JsonSchemaProxyHandler.isObject(additionalProperties)) { + return additionalProperties; + } else { + return JsonSchemaProxyHandler._unconstrainedSchema; + } } case 'array': { @@ -491,6 +497,8 @@ class JsonSchemaProxyHandler { } } +JsonSchemaProxyHandler._unconstrainedSchema = {}; + class JsonSchema { static createProxy(target, schema) { return new Proxy(target, new JsonSchemaProxyHandler(schema)); |