Skip to content

Commit 7634e4c

Browse files
committed
Merge changes from martin-mfg
Merge master
1 parent 168d3d1 commit 7634e4c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

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

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public class SpringCodegen extends AbstractJavaCodegen
9898
public static final String USE_SEALED = "useSealed";
9999
public static final String OPTIONAL_ACCEPT_NULLABLE = "optionalAcceptNullable";
100100
public static final String USE_SPRING_BUILT_IN_VALIDATION = "useSpringBuiltInValidation";
101+
public static final String USE_DEDUCTION_FOR_ONE_OF_INTERFACES = "useDeductionForOneOfInterfaces";
101102

102103
@Getter
103104
public enum RequestMappingMode {
@@ -157,6 +158,8 @@ public enum RequestMappingMode {
157158
protected boolean optionalAcceptNullable = true;
158159
@Getter @Setter
159160
protected boolean useSpringBuiltInValidation = false;
161+
@Getter @Setter
162+
protected boolean useDeductionForOneOfInterfaces = false;
160163

161164
public SpringCodegen() {
162165
super();
@@ -270,6 +273,7 @@ public SpringCodegen() {
270273
"Use `ofNullable` instead of just `of` to accept null values when using Optional.",
271274
optionalAcceptNullable));
272275

276+
cliOptions.add(CliOption.newBoolean(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "whether to use deduction for generated oneOf interfaces", useDeductionForOneOfInterfaces));
273277
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
274278
supportedLibraries.put(SPRING_CLOUD_LIBRARY,
275279
"Spring-Cloud-Feign client with Spring-Boot auto-configured settings.");
@@ -435,6 +439,7 @@ public void processOpts() {
435439
convertPropertyToBooleanAndWriteBack(USE_RESPONSE_ENTITY, this::setUseResponseEntity);
436440
convertPropertyToBooleanAndWriteBack(OPTIONAL_ACCEPT_NULLABLE, this::setOptionalAcceptNullable);
437441
convertPropertyToBooleanAndWriteBack(USE_SPRING_BUILT_IN_VALIDATION, this::setUseSpringBuiltInValidation);
442+
convertPropertyToBooleanAndWriteBack(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, this::setUseDeductionForOneOfInterfaces);
438443

439444
additionalProperties.put("springHttpStatus", new SpringHttpStatusLambda());
440445

0 commit comments

Comments
 (0)