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]); }
return additionalProperties;
} else {
const result = JsonSchemaProxyHandler._unconstrainedSchema;
const result = JsonSchemaProxyHandler.unconstrainedSchema;
if (path !== null) { path.push([null, result]); }
return result;
}
@ -167,7 +167,7 @@ class JsonSchemaProxyHandler {
if (path !== null) { path.push(['additionalItems', additionalItems]); }
return additionalItems;
} else {
const result = JsonSchemaProxyHandler._unconstrainedSchema;
const result = JsonSchemaProxyHandler.unconstrainedSchema;
if (path !== null) { path.push([null, 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 {
constructor(value, schema) {