Return unconstrained schema when additionalProperties is true/undefined
This commit is contained in:
parent
203216986e
commit
a844698f15
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user