forked from loafle/openapi-generator-original
Merge pull request #1405 from lugaru1234/returnTypeFix
ReturnType processing has been fixed
This commit is contained in:
commit
b7481586c3
@ -12,7 +12,8 @@ public class CodegenOperation {
|
|||||||
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
|
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
|
||||||
public Boolean hasAuthMethods, hasConsumes, hasProduces, hasParams, returnTypeIsPrimitive,
|
public Boolean hasAuthMethods, hasConsumes, hasProduces, hasParams, returnTypeIsPrimitive,
|
||||||
returnSimpleType, subresourceOperation, isMapContainer, isListContainer,
|
returnSimpleType, subresourceOperation, isMapContainer, isListContainer,
|
||||||
hasMore = Boolean.TRUE, isMultipart, isResponseBinary = Boolean.FALSE;
|
hasMore = Boolean.TRUE, isMultipart, isResponseBinary = Boolean.FALSE,
|
||||||
|
hasReference = Boolean.FALSE;
|
||||||
public String path, operationId, returnType, httpMethod, returnBaseType,
|
public String path, operationId, returnType, httpMethod, returnBaseType,
|
||||||
returnContainer, summary, notes, baseName, defaultResponse;
|
returnContainer, summary, notes, baseName, defaultResponse;
|
||||||
public List<Map<String, String>> consumes, produces;
|
public List<Map<String, String>> consumes, produces;
|
||||||
|
@ -1201,6 +1201,7 @@ public class DefaultCodegen {
|
|||||||
op.examples = new ExampleGenerator(definitions).generate(methodResponse.getExamples(), operation.getProduces(), responseProperty);
|
op.examples = new ExampleGenerator(definitions).generate(methodResponse.getExamples(), operation.getProduces(), responseProperty);
|
||||||
op.defaultResponse = toDefaultValue(responseProperty);
|
op.defaultResponse = toDefaultValue(responseProperty);
|
||||||
op.returnType = cm.datatype;
|
op.returnType = cm.datatype;
|
||||||
|
op.hasReference = definitions != null && definitions.containsKey(op.returnBaseType);
|
||||||
if (cm.isContainer != null) {
|
if (cm.isContainer != null) {
|
||||||
op.returnContainer = cm.containerType;
|
op.returnContainer = cm.containerType;
|
||||||
if ("map".equals(cm.containerType)) {
|
if ("map".equals(cm.containerType)) {
|
||||||
|
@ -94,17 +94,15 @@
|
|||||||
</div> <!-- field-items -->
|
</div> <!-- field-items -->
|
||||||
{{/hasFormParams}}
|
{{/hasFormParams}}
|
||||||
|
|
||||||
<!-- Remove Return type... unclear where this comes from;
|
|
||||||
for our swagger.json files, it is always empty and there is no boolean guard or hasReturnType
|
|
||||||
do we end up with a heading but not content
|
|
||||||
|
|
||||||
{{#returnType}}
|
{{#returnType}}
|
||||||
<h3 class="field-label">Return type</h3>
|
<h3 class="field-label">Return type</h3>
|
||||||
<div class="return-type"><a href="#{{returnContainer}}">{{{returnType}}}</a></div>
|
<div class="return-type">
|
||||||
|
{{#hasReference}}{{^returnSimpleType}}{{returnContainer}}[{{/returnSimpleType}}<a href="#{{returnBaseType}}">{{returnBaseType}}</a>{{^returnSimpleType}}]{{/returnSimpleType}}{{/hasReference}}
|
||||||
|
{{^hasReference}}{{returnType}}{{/hasReference}}
|
||||||
|
</div>
|
||||||
{{/returnType}}
|
{{/returnType}}
|
||||||
|
|
||||||
Todo: process Response Object and its headers, schema, examples
|
<!--Todo: process Response Object and its headers, schema, examples -->
|
||||||
-->
|
|
||||||
|
|
||||||
{{#hasExamples}}
|
{{#hasExamples}}
|
||||||
{{#examples}}
|
{{#examples}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user