ReturnType processing has been fixed

This commit is contained in:
Nadezhda Makarkina 2015-10-16 16:40:01 +03:00
parent 6b7ceab081
commit c298b7d152
3 changed files with 8 additions and 8 deletions

View File

@ -12,7 +12,8 @@ public class CodegenOperation {
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
public Boolean hasAuthMethods, hasConsumes, hasProduces, hasParams, returnTypeIsPrimitive,
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,
returnContainer, summary, notes, baseName, defaultResponse;
public List<Map<String, String>> consumes, produces;

View File

@ -1017,6 +1017,7 @@ public class DefaultCodegen {
op.examples = new ExampleGenerator(definitions).generate(methodResponse.getExamples(), operation.getProduces(), responseProperty);
op.defaultResponse = toDefaultValue(responseProperty);
op.returnType = cm.datatype;
op.hasReference = definitions != null && definitions.containsKey(op.returnBaseType);
if (cm.isContainer != null) {
op.returnContainer = cm.containerType;
if ("map".equals(cm.containerType)) {

View File

@ -94,17 +94,15 @@
</div> <!-- field-items -->
{{/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}}
<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}}
Todo: process Response Object and its headers, schema, examples
-->
<!--Todo: process Response Object and its headers, schema, examples -->
{{#hasExamples}}
{{#examples}}