Make JsonSchemaProxyHandler.unconstrainedSchema public and non-configurable (#636)

This commit is contained in:
toasted-nutbread 2020-07-03 11:55:39 -04:00 committed by GitHub
parent 0279d00274
commit 1d02013642
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,7 +139,7 @@ class JsonSchemaProxyHandler {
if (path !== null) { path.push(['additionalProperties', additionalProperties]); } if (path !== null) { path.push(['additionalProperties', additionalProperties]); }
return additionalProperties; return additionalProperties;
} else { } else {
const result = JsonSchemaProxyHandler._unconstrainedSchema; const result = JsonSchemaProxyHandler.unconstrainedSchema;
if (path !== null) { path.push([null, result]); } if (path !== null) { path.push([null, result]); }
return result; return result;
} }
@ -167,7 +167,7 @@ class JsonSchemaProxyHandler {
if (path !== null) { path.push(['additionalItems', additionalItems]); } if (path !== null) { path.push(['additionalItems', additionalItems]); }
return additionalItems; return additionalItems;
} else { } else {
const result = JsonSchemaProxyHandler._unconstrainedSchema; const result = JsonSchemaProxyHandler.unconstrainedSchema;
if (path !== null) { path.push([null, result]); } if (path !== null) { path.push([null, result]); }
return result; return result;
} }
@ -579,7 +579,12 @@ class JsonSchemaProxyHandler {
} }
} }
JsonSchemaProxyHandler._unconstrainedSchema = {}; Object.defineProperty(JsonSchemaProxyHandler, 'unconstrainedSchema', {
value: Object.freeze({}),
configurable: false,
enumerable: true,
writable: false
});
class JsonSchemaTraversalInfo { class JsonSchemaTraversalInfo {
constructor(value, schema) { constructor(value, schema) {