loop through composite schemas in _findSchema method
This commit is contained in:
parent
a418fbab01
commit
fc1a81a6f5
|
@ -2040,18 +2040,35 @@ Node._findEnum = function (schema) {
|
|||
*/
|
||||
Node._findSchema = function (schema, path) {
|
||||
var childSchema = schema;
|
||||
var foundSchema = childSchema;
|
||||
|
||||
var allSchemas = schema.oneOf || schema.anyOf || schema.allOf;
|
||||
if (!allSchemas) {
|
||||
allSchemas = [schema];
|
||||
}
|
||||
|
||||
for (var j = 0; j < allSchemas.length; j++) {
|
||||
childSchema = allSchemas[j];
|
||||
|
||||
for (var i = 0; i < path.length && childSchema; i++) {
|
||||
var key = path[i];
|
||||
|
||||
if (typeof key === 'string' && childSchema.properties) {
|
||||
childSchema = childSchema.properties[key] || null
|
||||
childSchema = childSchema.properties[key] || null;
|
||||
if (childSchema) {
|
||||
foundSchema = childSchema;
|
||||
}
|
||||
}
|
||||
else if (typeof key === 'number' && childSchema.items) {
|
||||
childSchema = childSchema.items
|
||||
childSchema = childSchema.items;
|
||||
if (childSchema) {
|
||||
foundSchema = childSchema;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return childSchema
|
||||
}
|
||||
return foundSchema
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue