From cb4b03fcf340ce60107ba84dde0422333572278f Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Fri, 25 Sep 2020 09:07:18 -0400 Subject: [PATCH] [Core, HTML2] Rendered docs are incomplete (#7510) Co-authored-by: Malachi Jones --- .../main/resources/htmlDocs2/index.mustache | 41 +- .../main/resources/htmlDocs2/paramB.mustache | 5 +- .../html.md/.openapi-generator/FILES | 1 + .../html.md/.openapi-generator/VERSION | 2 +- samples/documentation/html.md/index.html | 10 +- .../html/.openapi-generator/FILES | 1 + samples/documentation/html/index.html | 1 - .../html2/.openapi-generator/FILES | 1 + samples/documentation/html2/index.html | 1265 +++++++++-------- 9 files changed, 726 insertions(+), 601 deletions(-) create mode 100644 samples/documentation/html.md/.openapi-generator/FILES create mode 100644 samples/documentation/html/.openapi-generator/FILES create mode 100644 samples/documentation/html2/.openapi-generator/FILES diff --git a/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache b/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache index 5d4e979dff84..b646a0427aa0 100644 --- a/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache +++ b/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache @@ -103,29 +103,34 @@ }); function findNode(id, currentNode) { - return (Object.keys(currentNode)[0] === id) ? currentNode : findNodeInChildren(id, currentNode); - } - - function findNodeInChildren(id, currentNode) { - for (let prop in currentNode) { - if (currentNode.hasOwnProperty(prop)) { - let currentChild = currentNode[prop]; - if (id === prop) { - return currentChild; - } else { - // Search in the current child - if (typeof (currentChild) === 'object') { - let result = findNode(id, currentChild); - if (result !== false) { - return result; + var currentChild, + result; + + if ( Object.keys(currentNode)[0] == id) { + return currentNode; + } else { + // Use a for loop instead of forEach to avoid nested functions + // Otherwise "return" will not work properly + for(var propt in currentNode){ + if (currentNode.hasOwnProperty(propt)) { + currentChild = currentNode[propt] + if (id == propt) { + return currentChild; + } else { + // Search in the current child + if (typeof(currentChild) === 'object') { + result = findNode(id, currentChild); + if (result != false) { + return result; + } } } } } + // The node has not been found and we have no more options + return false; } - return false; } -