Merge pull request #459 from hachichaud/fix/enum-dropdown-with-composite
Display a dropdown for enums inside composite schemas
This commit is contained in:
commit
b6ce1c0653
|
@ -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