Skip to content

Commit 48d7411

Browse files
committed
feat(kotlin-spring and java-spring): add ValuedEnum interface and update related configurations to verify compilation success for both javax and jakarta setups in kotlin and java spring
1 parent 2bdcb2f commit 48d7411

89 files changed

Lines changed: 280 additions & 199 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bin/configs/kotlin-spring-boot-integer-enum.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ additionalProperties:
1111
annotationLibrary: none
1212
documentationProvider: none
1313
enumPropertyNaming: UPPERCASE
14+
useEnumValueInterface: "true"

bin/configs/kotlin-spring-boot.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ additionalProperties:
1111
serializableModel: "true"
1212
useBeanValidation: "true"
1313
requestMappingMode: controller
14+
useEnumValueInterface: "true"
15+
useSpringBoot3: "false"

bin/configs/spring-boot-3-include-http-request-context.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ additionalProperties:
1515
generateBuilders: true
1616
includeHttpRequestContext: "true"
1717
delegatePattern: true
18+
useEnumValueInterface: "true"

bin/configs/spring-boot-4.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ additionalProperties:
1515
generateConstructorWithAllArgs: true
1616
generateBuilders: true
1717
openApiNullable: false
18+
useEnumValueInterface: "true"

bin/configs/spring-boot-sort-validation.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ additionalProperties:
1818
generatePageableConstraintValidation: "true"
1919
useTags: "true"
2020
requestMappingMode: api_interface
21+
useEnumValueInterface: "true"

bin/configs/spring-boot.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ additionalProperties:
99
hideGenerationTimestamp: "true"
1010
camelCaseDollarSign: "true"
1111
modelNameSuffix: 'Dto'
12+
useEnumValueInterface: "true"
13+
useSpringBoot3: "false"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package {{configPackage}};
22

3+
import {{javaxPackage}}.annotation.Generated;
4+
35
{{>generatedAnnotation}}
6+
47
public interface ValuedEnum<T> {
58
T getValue();
69
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package {{configPackage}}
22

33
{{>generatedAnnotation}}
4+
45
interface ValuedEnum<T> {
56
val value: T
67
}

modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8068,7 +8068,8 @@ public void useEnumValueInterface_generatesInterface() throws IOException {
80688068
assertThat(files).containsKey("ValuedEnum.java");
80698069
JavaFileAssert.assertThat(files.get("ValuedEnum.java"))
80708070
.isInterface()
8071-
.fileContains("interface ValuedEnum<T>");
8071+
.fileContains("interface ValuedEnum<T>")
8072+
.hasImports("jakarta.annotation.Generated");
80728073
}
80738074

80748075
@Test

samples/openapi3/server/petstore/springboot-3-include-http-request-context/.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ src/main/java/org/openapitools/api/UserApi.java
1111
src/main/java/org/openapitools/api/UserApiDelegate.java
1212
src/main/java/org/openapitools/configuration/HomeController.java
1313
src/main/java/org/openapitools/configuration/SpringDocConfiguration.java
14+
src/main/java/org/openapitools/configuration/ValuedEnum.java
1415
src/main/java/org/openapitools/model/Category.java
1516
src/main/java/org/openapitools/model/ModelApiResponse.java
1617
src/main/java/org/openapitools/model/Order.java

0 commit comments

Comments
 (0)