Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core, HTML2] Rendered docs are incomplete #3496

Closed
wants to merge 1 commit into from
Closed
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 @@ -4947,7 +4947,9 @@ public CodegenParameter fromRequestBody(RequestBody body, Set<String> imports, S
// set nullable
setParameterNullable(codegenParameter, codegenProperty);
}

// Adding JsonSchema for body request in case that is not present.
if(codegenParameter.jsonSchema == null)
codegenParameter.jsonSchema = Json.pretty(body);
// set the parameter's example value
// should be overridden by lang codegen
setParameterExampleValue(codegenParameter, body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,12 +488,12 @@ private Model getParent(Model model) {
// TODO revise below as we've already performed unaliasing so that the isAlias check may be removed
Map<String, Object> modelTemplate = (Map<String, Object>) ((List<Object>) models.get("models")).get(0);
// Special handling of aliases only applies to Java
if (modelTemplate != null && modelTemplate.containsKey("model")) {
CodegenModel m = (CodegenModel) modelTemplate.get("model");
if (m.isAlias) {
continue; // Don't create user-defined classes for aliases
}
}
// if (modelTemplate != null && modelTemplate.containsKey("model")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain what is the impact of this change?

// CodegenModel m = (CodegenModel) modelTemplate.get("model");
// if (m.isAlias) {
// continue; // Don't create user-defined classes for aliases
// }
// }

allModels.add(modelTemplate);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,33 @@
//Convert elements with "marked" class to markdown
processMarked();
});

function findNode(id, currentNode) {
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){
currentChild = currentNode[propt]
if (id == propt) {
return currentChild;
} else {
// Search in the current child
if (typeof(currentNode[propt]) === 'object') {
result = findNode(id, currentChild);
if (result != false)
return result;
}
}
}
// The node has not been found and we have no more options
return false;
}
}
</script>
<style type="text/css">
{{>fonts}}
Expand Down Expand Up @@ -416,7 +443,11 @@
<script>
$(document).ready(function() {
var schemaWrapper = {{{jsonSchema}}};
var schema = schemaWrapper.schema;

var schema = findNode('schema',schemaWrapper).schema;
if (!schema) {
schema = schemaWrapper.schema;
}
if (schema.$ref != null) {
schema = defsParser.$refs.get(schema.$ref);
} else {
Expand Down Expand Up @@ -505,8 +536,7 @@
{{>js_json_stringify_safe}}
{{>js_webfontloader}}
<script>
var schemaWrapper = {};
schemaWrapper.definitions = Object.assign({}, defs);
var schemaWrapper = { "components": { "schemas" : defs}};
defsParser = new $RefParser();
defsParser.dereference(schemaWrapper).catch(function(err) {
console.log(err);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
<script>
$(document).ready(function() {
var schemaWrapper = {{{jsonSchema}}};
var schema = schemaWrapper.schema;

var schema = findNode('schema',schemaWrapper).schema;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will find node alway return a result here?

if (!schema) {
schema = schemaWrapper.schema;
}
if (schema.$ref != null) {
schema = defsParser.$refs.get(schema.$ref);
} else {
Expand Down
2 changes: 1 addition & 1 deletion samples/documentation/html2/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.1-SNAPSHOT
4.1.0-SNAPSHOT
Loading