Skip to content

Commit bd58fdc

Browse files
authored
kotlin-spring: minor updates (#24663)
1 parent 49418a5 commit bd58fdc

1 file changed

Lines changed: 7 additions & 18 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,13 @@ public enum DeclarativeInterfaceReactiveMode {
129129
}
130130
}
131131

132-
132+
@Getter
133133
public enum RequestMappingMode {
134134
api_interface("Generate the @RequestMapping annotation on the generated Api Interface."),
135135
controller("Generate the @RequestMapping annotation on the generated Api Controller Implementation."),
136136
none("Do not add a class level @RequestMapping annotation.");
137137

138-
public String getDescription() {
139-
return description;
140-
}
141-
142-
private String description;
138+
private final String description;
143139

144140
RequestMappingMode(String description) {
145141
this.description = description;
@@ -196,13 +192,15 @@ public String getDescription() {
196192
protected boolean useSpringBoot4 = false;
197193
@Getter @Setter
198194
protected boolean useSpringBuiltInValidation = false;
195+
@Setter
196+
@Getter
199197
protected RequestMappingMode requestMappingMode = RequestMappingMode.controller;
200198
private DocumentationProvider documentationProvider;
201199
private AnnotationLibrary annotationLibrary;
202200

203201
// Map to track which models implement which sealed response interfaces
204-
private Map<String, List<String>> modelToSealedInterfaces = new HashMap<>();
205-
private Map<String, String> sealedInterfaceToOperationId = new HashMap<>();
202+
private final Map<String, List<String>> modelToSealedInterfaces = new HashMap<>();
203+
private final Map<String, String> sealedInterfaceToOperationId = new HashMap<>();
206204
private boolean sealedInterfacesFileWritten = false;
207205

208206
// 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
11281126
// Run through toModelName so that schemaMappings (e.g. User → com.example.MyUser)
11291127
// are honored: the mapped name is used both in the type arg and for import resolution.
11301128
String itemType = toModelName(detected.itemSchemaName);
1131-
String newBaseType = pagedModelClassName + "<" + itemType + ">";
1132-
codegenOperation.returnType = newBaseType;
1129+
codegenOperation.returnType = pagedModelClassName + "<" + itemType + ">";
11331130
codegenOperation.returnBaseType = pagedModelClassName;
11341131
// Clear any container flag — PagedModel is not itself a List/array
11351132
codegenOperation.returnContainer = null;
@@ -1872,14 +1869,6 @@ protected boolean needToImport(String type) {
18721869
return !type.startsWith("org.springframework.") && super.needToImport(type);
18731870
}
18741871

1875-
public RequestMappingMode getRequestMappingMode() {
1876-
return requestMappingMode;
1877-
}
1878-
1879-
public void setRequestMappingMode(RequestMappingMode requestMappingMode) {
1880-
this.requestMappingMode = requestMappingMode;
1881-
}
1882-
18831872
@Override
18841873
public List<VendorExtension> getSupportedVendorExtensions() {
18851874
List<VendorExtension> extensions = super.getSupportedVendorExtensions();

0 commit comments

Comments
 (0)