Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

</script>
<style type="text/css">
{{>fonts}}
Expand Down Expand Up @@ -447,7 +452,7 @@
var schemaWrapper = {{{jsonSchema}}};
var schema = findNode('schema',schemaWrapper).schema;
if (!schema) {
schema = schemaWrapper.schema;
schema = schemaWrapper.schema;
}
if (schema.$ref != null) {
schema = defsParser.$refs.get(schema.$ref);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
<script>
$(document).ready(function() {
var schemaWrapper = {{{jsonSchema}}};
var schema = findNode('schema', schemaWrapper).schema;

var schema = findNode('schema',schemaWrapper).schema;
if (!schema) {
schema = schemaWrapper.schema;
schema = schemaWrapper.schema;
}
if (schema.$ref != null) {
schema = defsParser.$refs.get(schema.$ref);
Expand Down
1 change: 1 addition & 0 deletions samples/documentation/html.md/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
index.html
2 changes: 1 addition & 1 deletion samples/documentation/html.md/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-SNAPSHOT
5.0.0-SNAPSHOT
10 changes: 5 additions & 5 deletions samples/documentation/html.md/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ <h1>An <em>API</em> with more <strong>Markdown</strong> in summary, description,
<li>in schema (model) member descriptions</li>
</ol>
</div>
<div class="app-desc">More information: <a href="https://helloreverb.com">https://helloreverb.com</a></div>
<div class="app-desc">Contact Info: <a href="[email protected]">[email protected]</a></div>
<div class="app-desc">More information: <a href="https://openapi-generator.tech">https://openapi-generator.tech</a></div>
<div class="app-desc">Contact Info: <a href="[email protected]">[email protected]</a></div>
<div class="app-desc">Version: 0.1.0</div>
<div class="app-desc">BasePath:/v1</div>
<div class="license-info">All rights reserved</div>
Expand Down Expand Up @@ -226,7 +226,7 @@ <h3 class="field-label">Query parameters</h3>
<div class="field-items">
<div class="param">seed (required)</div>

<div class="param-desc"><span class="param-type">Query Parameter</span> &mdash; A random number <em>seed</em>. </div>
<div class="param-desc"><span class="param-type">Query Parameter</span> &mdash; A random number <em>seed</em>. default: null </div>
</div> <!-- field-items -->


Expand All @@ -242,8 +242,8 @@ <h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: */*</div>
<pre class="example"><code>{
"sequence" : 1,
"seed" : 6.02745618307040320615897144307382404804229736328125,
"value" : 0.80082819046101150206595775671303272247314453125
"seed" : 6.027456183070403,
"value" : 0.8008281904610115
}</code></pre>

<h3 class="field-label">Produces</h3>
Expand Down
1 change: 1 addition & 0 deletions samples/documentation/html/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
index.html
1 change: 0 additions & 1 deletion samples/documentation/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ <h1>OpenAPI Petstore</h1>
<h2>Access</h2>
<ol>
<li>APIKey KeyParamName:api_key KeyInQuery:false KeyInHeader:true</li>
<li>APIKey KeyParamName:AUTH_KEY KeyInQuery:false KeyInHeader:false</li>
<li>OAuth AuthorizationUrl:http://petstore.swagger.io/api/oauth/dialogTokenUrl:</li>
</ol>

Expand Down
1 change: 1 addition & 0 deletions samples/documentation/html2/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
index.html
Loading