From c029f716dad4e033a81e2910580745b9a49a4840 Mon Sep 17 00:00:00 2001 From: plany Date: Mon, 20 Nov 2017 17:32:58 +0100 Subject: [PATCH] Display a dropdown for enums inside pattern properties --- src/js/Node.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/js/Node.js b/src/js/Node.js index f70bd0f..c0d306e 100644 --- a/src/js/Node.js +++ b/src/js/Node.js @@ -2069,7 +2069,18 @@ Node._findSchema = function (schema, path) { for (var i = 0; i < path.length && childSchema; i++) { var key = path[i]; - if (typeof key === 'string' && childSchema.properties) { + if (typeof key === 'string' && childSchema.patternProperties && i == path.length - 1) { + for (var prop in childSchema.patternProperties) { + foundSchema = Node._findSchema(childSchema.patternProperties[prop], path.slice(i, path.length)); + } + } + else if (childSchema.items && childSchema.items.properties) { + childSchema = childSchema.items.properties[key]; + if (childSchema) { + foundSchema = Node._findSchema(childSchema, path.slice(i, path.length)); + } + } + else if (typeof key === 'string' && childSchema.properties) { childSchema = childSchema.properties[key] || null; if (childSchema) { foundSchema = Node._findSchema(childSchema, path.slice(i, path.length));