diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java index dbde68dc8e7e..b05fc5df0432 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java @@ -129,17 +129,13 @@ public enum DeclarativeInterfaceReactiveMode { } } - + @Getter public enum RequestMappingMode { api_interface("Generate the @RequestMapping annotation on the generated Api Interface."), controller("Generate the @RequestMapping annotation on the generated Api Controller Implementation."), none("Do not add a class level @RequestMapping annotation."); - public String getDescription() { - return description; - } - - private String description; + private final String description; RequestMappingMode(String description) { this.description = description; @@ -196,13 +192,15 @@ public String getDescription() { protected boolean useSpringBoot4 = false; @Getter @Setter protected boolean useSpringBuiltInValidation = false; + @Setter + @Getter protected RequestMappingMode requestMappingMode = RequestMappingMode.controller; private DocumentationProvider documentationProvider; private AnnotationLibrary annotationLibrary; // Map to track which models implement which sealed response interfaces - private Map> modelToSealedInterfaces = new HashMap<>(); - private Map sealedInterfaceToOperationId = new HashMap<>(); + private final Map> modelToSealedInterfaces = new HashMap<>(); + private final Map sealedInterfaceToOperationId = new HashMap<>(); private boolean sealedInterfacesFileWritten = false; // Map from schema name to detected paged-model info (populated when substituteGenericPagedModel=true) @@ -1128,8 +1126,7 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation // Run through toModelName so that schemaMappings (e.g. User → com.example.MyUser) // are honored: the mapped name is used both in the type arg and for import resolution. String itemType = toModelName(detected.itemSchemaName); - String newBaseType = pagedModelClassName + "<" + itemType + ">"; - codegenOperation.returnType = newBaseType; + codegenOperation.returnType = pagedModelClassName + "<" + itemType + ">"; codegenOperation.returnBaseType = pagedModelClassName; // Clear any container flag — PagedModel is not itself a List/array codegenOperation.returnContainer = null; @@ -1872,14 +1869,6 @@ protected boolean needToImport(String type) { return !type.startsWith("org.springframework.") && super.needToImport(type); } - public RequestMappingMode getRequestMappingMode() { - return requestMappingMode; - } - - public void setRequestMappingMode(RequestMappingMode requestMappingMode) { - this.requestMappingMode = requestMappingMode; - } - @Override public List getSupportedVendorExtensions() { List extensions = super.getSupportedVendorExtensions();