diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java index 70d65171e1a..5fd3214b5e2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java @@ -168,12 +168,12 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo } @SuppressWarnings("unchecked") - Map operationsMap = (Map) operations.get("operations"); + Map operationsMap = (Map) operations.get("operations"); List operationList = (List) operationsMap.get("operation"); - for (CodegenOperation operation: operationList) { + for (CodegenOperation operation: operationList) { List responses = operation.responses; - operation.returnType = this.getReturnType(responses); - } + operation.returnType = this.getReturnType(responses); + } return operations; } @@ -183,29 +183,29 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo boolean atLeastOneSuccess = false; boolean addVoid = false; System.out.println(responses); - for (CodegenResponse response: responses) { - // TODO: we should probably catch an exception here - if (response.isSuccessCode) { - if (response.dataType != null) { - if (!firstReturnType) { - returnType.append(" | "); - } - returnType.append(response.dataType); - firstReturnType = false; - atLeastOneSuccess = true; - } else { - addVoid = true; - } - } - } - if (!atLeastOneSuccess) { - return null; - } else if (addVoid) { - returnType.append(" | void"); - } - - System.out.println("Return Type: " + returnType); - return returnType.toString(); + for (CodegenResponse response: responses) { + // TODO: we should probably catch an exception here + if (response.isSuccessCode) { + if (response.dataType != null) { + if (!firstReturnType) { + returnType.append(" | "); + } + returnType.append(response.dataType); + firstReturnType = false; + atLeastOneSuccess = true; + } else { + addVoid = true; + } + } + } + if (!atLeastOneSuccess) { + return null; + } else if (addVoid) { + returnType.append(" | void"); + } + + System.out.println("Return Type: " + returnType); + return returnType.toString(); } private String getModelnameFromModelFilename(String filename) {