Skip to content

Commit 7f1fc88

Browse files
committed
revert unrelated formatting changes
1 parent 9fea3ca commit 7f1fc88

1 file changed

Lines changed: 46 additions & 67 deletions

File tree

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

Lines changed: 46 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -124,60 +124,38 @@ public String getDescription() {
124124
}
125125
}
126126

127-
@Getter
128-
@Setter
127+
@Getter @Setter
129128
private String basePackage;
130-
@Getter
131-
@Setter
129+
@Getter @Setter
132130
protected String configPackage;
133-
@Getter
134-
@Setter
131+
@Getter @Setter
135132
private String invokerPackage;
136-
@Getter
137-
@Setter
133+
@Getter @Setter
138134
private String serverPort = "8080";
139135
private String title = "OpenAPI Kotlin Spring";
140136
private boolean useBeanValidation = true;
141-
@Setter
142-
private boolean skipDefaultInterface = false;
143-
@Setter
144-
private boolean skipDefaultApiInterface = false;
145-
@Setter
146-
private boolean skipDefaultDelegateInterface = false;
147-
@Setter
148-
private boolean exceptionHandler = true;
149-
@Setter
150-
private boolean gradleBuildFile = true;
137+
@Setter private boolean skipDefaultInterface = false;
138+
@Setter private boolean skipDefaultApiInterface = false;
139+
@Setter private boolean skipDefaultDelegateInterface = false;
140+
@Setter private boolean exceptionHandler = true;
141+
@Setter private boolean gradleBuildFile = true;
151142
private boolean useSwaggerUI = true;
152-
@Setter
153-
private boolean serviceInterface = false;
154-
@Setter
155-
private boolean serviceImplementation = false;
156-
@Getter
157-
@Setter
143+
@Setter private boolean serviceInterface = false;
144+
@Setter private boolean serviceImplementation = false;
145+
@Getter @Setter
158146
private boolean reactive = false;
159-
@Setter
160-
private DeclarativeInterfaceReactiveMode declarativeInterfaceReactiveMode = DeclarativeInterfaceReactiveMode.coroutines;
161-
@Getter
162-
@Setter
147+
@Getter @Setter
163148
private boolean useFlowForArrayReturnType = true;
164-
@Setter
165-
private boolean interfaceOnly = false;
166-
@Setter
167-
protected boolean useFeignClientUrl = true;
168-
@Setter
169-
protected boolean useFeignClient = false;
170-
@Setter
171-
private boolean delegatePattern = false;
172-
@Setter
173-
protected boolean useTags = false;
174-
@Setter
175-
private boolean beanQualifiers = false;
176-
@Setter
177-
private boolean declarativeInterfaceWrapResponses = false;
178-
179-
@Getter
180-
@Setter
149+
@Setter private boolean interfaceOnly = false;
150+
@Setter protected boolean useFeignClientUrl = true;
151+
@Setter protected boolean useFeignClient = false;
152+
@Setter private boolean delegatePattern = false;
153+
@Setter protected boolean useTags = false;
154+
@Setter private boolean beanQualifiers = false;
155+
@Setter private DeclarativeInterfaceReactiveMode declarativeInterfaceReactiveMode = DeclarativeInterfaceReactiveMode.coroutines;
156+
@Setter private boolean declarativeInterfaceWrapResponses = false;
157+
158+
@Getter @Setter
181159
protected boolean useSpringBoot3 = false;
182160
protected RequestMappingMode requestMappingMode = RequestMappingMode.controller;
183161
private DocumentationProvider documentationProvider;
@@ -245,10 +223,10 @@ public KotlinSpringServerCodegen() {
245223
addSwitch(GRADLE_BUILD_FILE, "generate a gradle build file using the Kotlin DSL", gradleBuildFile);
246224
addSwitch(USE_SWAGGER_UI, "Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies", useSwaggerUI);
247225
addSwitch(SERVICE_INTERFACE, "generate service interfaces to go alongside controllers. In most " +
248-
"cases this option would be used to update an existing project, so not to override implementations. " +
249-
"Useful to help facilitate the generation gap pattern", serviceInterface);
226+
"cases this option would be used to update an existing project, so not to override implementations. " +
227+
"Useful to help facilitate the generation gap pattern", serviceInterface);
250228
addSwitch(SERVICE_IMPLEMENTATION, "generate stub service implementations that extends service " +
251-
"interfaces. If this is set to true service interfaces will also be generated", serviceImplementation);
229+
"interfaces. If this is set to true service interfaces will also be generated", serviceImplementation);
252230
addSwitch(USE_BEANVALIDATION, "Use BeanValidation API annotations to validate data types", useBeanValidation);
253231
addSwitch(SKIP_DEFAULT_INTERFACE, "Whether to skip generation of default implementations for interfaces (Api interfaces or Delegate interfaces depending on the delegatePattern option)", skipDefaultInterface);
254232
addSwitch(REACTIVE, "use coroutines for reactive behavior", reactive);
@@ -257,8 +235,8 @@ public KotlinSpringServerCodegen() {
257235
addSwitch(DELEGATE_PATTERN, "Whether to generate the server files using the delegate pattern", delegatePattern);
258236
addSwitch(USE_TAGS, "Whether to use tags for creating interface and controller class names", useTags);
259237
addSwitch(BEAN_QUALIFIERS, "Whether to add fully-qualifier class names as bean qualifiers in @Component and " +
260-
"@RestController annotations. May be used to prevent bean names clash if multiple generated libraries" +
261-
" (contexts) added to single project.", beanQualifiers);
238+
"@RestController annotations. May be used to prevent bean names clash if multiple generated libraries" +
239+
" (contexts) added to single project.", beanQualifiers);
262240
addSwitch(USE_SPRING_BOOT3, "Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.", useSpringBoot3);
263241
addSwitch(USE_FLOW_FOR_ARRAY_RETURN_TYPE, "Whether to use Flow for array/collection return types when reactive is enabled. If false, will use List instead.", useFlowForArrayReturnType);
264242
addSwitch(DECLARATIVE_INTERFACE_WRAP_RESPONSES,
@@ -361,7 +339,7 @@ public List<AnnotationLibrary> supportedAnnotationLibraries() {
361339
*/
362340
private boolean selectedDocumentationProviderRequiresSwaggerUiBootstrap() {
363341
return getDocumentationProvider().equals(DocumentationProvider.SPRINGFOX) ||
364-
getDocumentationProvider().equals(DocumentationProvider.SOURCE);
342+
getDocumentationProvider().equals(DocumentationProvider.SOURCE);
365343
}
366344

367345
public boolean getExceptionHandler() {
@@ -489,7 +467,7 @@ public void processOpts() {
489467

490468
// Set basePackage from invokerPackage
491469
if (!additionalProperties.containsKey(BASE_PACKAGE)
492-
&& additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
470+
&& additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
493471
this.setBasePackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
494472
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
495473
additionalProperties.put(BASE_PACKAGE, basePackage);
@@ -695,6 +673,7 @@ public void processOpts() {
695673

696674
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
697675

676+
698677
if (this.exceptionHandler && !(library.equals(SPRING_CLOUD_LIBRARY) || library.equals(SPRING_DECLARATIVE_HTTP_INTERFACE_LIBRARY))) {
699678
supportingFiles.add(new SupportingFile("exceptions.mustache",
700679
sanitizeDirectory(sourceFolder + File.separator + apiPackage), "Exceptions.kt"));
@@ -823,16 +802,16 @@ public void processOpts() {
823802
}
824803

825804
switch (getRequestMappingMode()) {
826-
case api_interface:
827-
additionalProperties.put(USE_REQUEST_MAPPING_ON_INTERFACE, true);
828-
break;
829-
case controller:
830-
additionalProperties.put(USE_REQUEST_MAPPING_ON_CONTROLLER, true);
831-
break;
832-
case none:
833-
additionalProperties.put(USE_REQUEST_MAPPING_ON_INTERFACE, false);
834-
additionalProperties.put(USE_REQUEST_MAPPING_ON_CONTROLLER, false);
835-
break;
805+
case api_interface:
806+
additionalProperties.put(USE_REQUEST_MAPPING_ON_INTERFACE, true);
807+
break;
808+
case controller:
809+
additionalProperties.put(USE_REQUEST_MAPPING_ON_CONTROLLER, true);
810+
break;
811+
case none:
812+
additionalProperties.put(USE_REQUEST_MAPPING_ON_INTERFACE, false);
813+
additionalProperties.put(USE_REQUEST_MAPPING_ON_CONTROLLER, false);
814+
break;
836815
}
837816

838817
// spring uses the jackson lib, and we disallow configuration.
@@ -882,7 +861,7 @@ public void preprocessOpenAPI(OpenAPI openAPI) {
882861

883862
if (SPRING_BOOT.equals(library) && ModelUtils.containsEnums(this.openAPI)) {
884863
supportingFiles.add(new SupportingFile("converter.mustache",
885-
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "EnumConverterConfiguration.kt"));
864+
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "EnumConverterConfiguration.kt"));
886865
}
887866

888867
if (!additionalProperties.containsKey(TITLE)) {
@@ -1034,9 +1013,9 @@ public void setReturnContainer(final String returnContainer) {
10341013
operation.returnContainer = returnContainer;
10351014
}
10361015
});
1037-
// if(implicitHeaders){
1038-
// removeHeadersFromAllParams(operation.allParams);
1039-
// }
1016+
// if(implicitHeaders){
1017+
// removeHeadersFromAllParams(operation.allParams);
1018+
// }
10401019
});
10411020
}
10421021

@@ -1049,6 +1028,7 @@ public Map<String, Object> postProcessSupportingFileData(Map<String, Object> obj
10491028
return objs;
10501029
}
10511030

1031+
10521032
private String getNonMutableContainerTypeIfNeeded(String type) {
10531033
if (type != null && type.contains("kotlin.collections.Mutable")) {
10541034
return type.replaceAll("kotlin\\.collections\\.Mutable", "kotlin.collections.");
@@ -1062,7 +1042,6 @@ private static String sanitizeDirectory(String in) {
10621042

10631043
// TODO could probably be made more generic, and moved to the `mustache` package if required by other components.
10641044
private static class EscapeLambda implements Mustache.Lambda {
1065-
10661045
private final String from;
10671046
private final String to;
10681047

0 commit comments

Comments
 (0)