fix(#9682): API class has multiple imports of 'okhttp3.ResponseBody' (#16638)

This commit is contained in:
Julian Kalinowski
2023-09-22 07:41:13 +02:00
committed by GitHub
parent 0f2a27d3c5
commit 55c580579e
2 changed files with 3 additions and 6 deletions

View File

@@ -861,9 +861,11 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels) {
super.postProcessOperationsWithModels(objs, allModels);
OperationMap operations = objs.getOperations();
boolean isResponseFile = false;
if (operations != null) {
List<CodegenOperation> ops = operations.getOperation();
for (CodegenOperation operation : ops) {
isResponseFile = isResponseFile || operation.isResponseFile;
if (JVM_RETROFIT2.equals(getLibrary()) && StringUtils.isNotEmpty(operation.path) && operation.path.startsWith("/")) {
operation.path = operation.path.substring(1);
@@ -940,6 +942,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
}
}
}
objs.put("isResponseFile", isResponseFile);
return objs;
}

View File

@@ -65,12 +65,6 @@ import okhttp3.MultipartBody
{{/isMultipart}}
{{/x-kotlin-multipart-import}}
{{#operation}}
{{#isResponseFile}}
import okhttp3.ResponseBody
{{/isResponseFile}}
{{/operation}}
interface {{classname}} {
{{#operation}}
{{#allParams}}