Removed tabs in TypeScriptClientCodegen

This commit is contained in:
Tino Fuhrmann 2018-12-06 23:28:09 +01:00
parent 35b98cf2bc
commit 8bfb88cd76

View File

@ -168,12 +168,12 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Map<String, Object> operationsMap = (Map<String, Object>) operations.get("operations"); Map<String, Object> operationsMap = (Map<String, Object>) operations.get("operations");
List<CodegenOperation> operationList = (List<CodegenOperation>) operationsMap.get("operation"); List<CodegenOperation> operationList = (List<CodegenOperation>) operationsMap.get("operation");
for (CodegenOperation operation: operationList) { for (CodegenOperation operation: operationList) {
List<CodegenResponse> responses = operation.responses; List<CodegenResponse> responses = operation.responses;
operation.returnType = this.getReturnType(responses); operation.returnType = this.getReturnType(responses);
} }
return operations; return operations;
} }
@ -183,29 +183,29 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
boolean atLeastOneSuccess = false; boolean atLeastOneSuccess = false;
boolean addVoid = false; boolean addVoid = false;
System.out.println(responses); System.out.println(responses);
for (CodegenResponse response: responses) { for (CodegenResponse response: responses) {
// TODO: we should probably catch an exception here // TODO: we should probably catch an exception here
if (response.isSuccessCode) { if (response.isSuccessCode) {
if (response.dataType != null) { if (response.dataType != null) {
if (!firstReturnType) { if (!firstReturnType) {
returnType.append(" | "); returnType.append(" | ");
} }
returnType.append(response.dataType); returnType.append(response.dataType);
firstReturnType = false; firstReturnType = false;
atLeastOneSuccess = true; atLeastOneSuccess = true;
} else { } else {
addVoid = true; addVoid = true;
} }
} }
} }
if (!atLeastOneSuccess) { if (!atLeastOneSuccess) {
return null; return null;
} else if (addVoid) { } else if (addVoid) {
returnType.append(" | void"); returnType.append(" | void");
} }
System.out.println("Return Type: " + returnType); System.out.println("Return Type: " + returnType);
return returnType.toString(); return returnType.toString();
} }
private String getModelnameFromModelFilename(String filename) { private String getModelnameFromModelFilename(String filename) {