mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-18 22:19:08 +00:00
committed by
William Cheng
parent
cbe39ba881
commit
c3efb91e31
@@ -21,6 +21,7 @@ import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.PathItem;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
@@ -36,6 +37,7 @@ import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
public class SpringCodegen extends AbstractJavaCodegen
|
||||
@@ -377,7 +379,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
if (this.java8) {
|
||||
additionalProperties.put("javaVersion", "1.8");
|
||||
if (!SPRING_CLOUD_LIBRARY.equals(library)) {
|
||||
additionalProperties.put("jdk8", "true");
|
||||
additionalProperties.put("jdk8", true);
|
||||
}
|
||||
if (this.async) {
|
||||
additionalProperties.put(RESPONSE_WRAPPER, "CompletableFuture");
|
||||
@@ -395,29 +397,32 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
|
||||
|
||||
// Some well-known Spring or Spring-Cloud response wrappers
|
||||
switch (this.responseWrapper) {
|
||||
case "Future":
|
||||
case "Callable":
|
||||
case "CompletableFuture":
|
||||
additionalProperties.put(RESPONSE_WRAPPER, "java.util.concurrent." + this.responseWrapper);
|
||||
break;
|
||||
case "ListenableFuture":
|
||||
additionalProperties.put(RESPONSE_WRAPPER, "org.springframework.util.concurrent.ListenableFuture");
|
||||
break;
|
||||
case "DeferredResult":
|
||||
additionalProperties.put(RESPONSE_WRAPPER, "org.springframework.web.context.request.async.DeferredResult");
|
||||
break;
|
||||
case "HystrixCommand":
|
||||
additionalProperties.put(RESPONSE_WRAPPER, "com.netflix.hystrix.HystrixCommand");
|
||||
break;
|
||||
case "RxObservable":
|
||||
additionalProperties.put(RESPONSE_WRAPPER, "rx.Observable");
|
||||
break;
|
||||
case "RxSingle":
|
||||
additionalProperties.put(RESPONSE_WRAPPER, "rx.Single");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (isNotEmpty(this.responseWrapper)) {
|
||||
additionalProperties.put("jdk8", false);
|
||||
switch (this.responseWrapper) {
|
||||
case "Future":
|
||||
case "Callable":
|
||||
case "CompletableFuture":
|
||||
additionalProperties.put(RESPONSE_WRAPPER, "java.util.concurrent." + this.responseWrapper);
|
||||
break;
|
||||
case "ListenableFuture":
|
||||
additionalProperties.put(RESPONSE_WRAPPER, "org.springframework.util.concurrent.ListenableFuture");
|
||||
break;
|
||||
case "DeferredResult":
|
||||
additionalProperties.put(RESPONSE_WRAPPER, "org.springframework.web.context.request.async.DeferredResult");
|
||||
break;
|
||||
case "HystrixCommand":
|
||||
additionalProperties.put(RESPONSE_WRAPPER, "com.netflix.hystrix.HystrixCommand");
|
||||
break;
|
||||
case "RxObservable":
|
||||
additionalProperties.put(RESPONSE_WRAPPER, "rx.Observable");
|
||||
break;
|
||||
case "RxSingle":
|
||||
additionalProperties.put(RESPONSE_WRAPPER, "rx.Single");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// add lambda for mustache templates
|
||||
|
||||
Reference in New Issue
Block a user