Skip to content

Commit 31089c0

Browse files
[Java-Spring] add comment to EnumConverterConfiguration mustache file (#21598)
* [java-spring] provide a clarifying comment for the generated EnumConverterConfiguration class * update samples --------- Co-authored-by: Chris Gual <[email protected]>
1 parent 20ed1ee commit 31089c0

File tree

21 files changed

+147
-0
lines changed

21 files changed

+147
-0
lines changed

modules/openapi-generator/src/main/resources/JavaSpring/converter.mustache

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ import org.springframework.context.annotation.Bean;
1212
import org.springframework.context.annotation.Configuration;
1313
import org.springframework.core.convert.converter.Converter;
1414

15+
/**
16+
* This class provides Spring Converter beans for the enum models in the OpenAPI specification.
17+
*
18+
* By default, Spring only converts primitive types to enums using Enum::valueOf, which can prevent
19+
* correct conversion if the OpenAPI specification is using an `enumPropertyNaming` other than
20+
* `original` or the specification has an integer enum.
21+
*/
1522
@Configuration(value = "{{configPackage}}.enumConverterConfiguration")
1623
public class EnumConverterConfiguration {
1724

samples/openapi3/server/petstore/spring-boot-oneof-sealed/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
import org.springframework.context.annotation.Configuration;
77
import org.springframework.core.convert.converter.Converter;
88

9+
/**
10+
* This class provides Spring Converter beans for the enum models in the OpenAPI specification.
11+
*
12+
* By default, Spring only converts primitive types to enums using Enum::valueOf, which can prevent
13+
* correct conversion if the OpenAPI specification is using an `enumPropertyNaming` other than
14+
* `original` or the specification has an integer enum.
15+
*/
916
@Configuration(value = "org.openapitools.configuration.enumConverterConfiguration")
1017
public class EnumConverterConfiguration {
1118

samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
import org.springframework.context.annotation.Configuration;
77
import org.springframework.core.convert.converter.Converter;
88

9+
/**
10+
* This class provides Spring Converter beans for the enum models in the OpenAPI specification.
11+
*
12+
* By default, Spring only converts primitive types to enums using Enum::valueOf, which can prevent
13+
* correct conversion if the OpenAPI specification is using an `enumPropertyNaming` other than
14+
* `original` or the specification has an integer enum.
15+
*/
916
@Configuration(value = "org.openapitools.configuration.enumConverterConfiguration")
1017
public class EnumConverterConfiguration {
1118

samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
import org.springframework.context.annotation.Configuration;
88
import org.springframework.core.convert.converter.Converter;
99

10+
/**
11+
* This class provides Spring Converter beans for the enum models in the OpenAPI specification.
12+
*
13+
* By default, Spring only converts primitive types to enums using Enum::valueOf, which can prevent
14+
* correct conversion if the OpenAPI specification is using an `enumPropertyNaming` other than
15+
* `original` or the specification has an integer enum.
16+
*/
1017
@Configuration(value = "org.openapitools.configuration.enumConverterConfiguration")
1118
public class EnumConverterConfiguration {
1219

samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
import org.springframework.context.annotation.Configuration;
88
import org.springframework.core.convert.converter.Converter;
99

10+
/**
11+
* This class provides Spring Converter beans for the enum models in the OpenAPI specification.
12+
*
13+
* By default, Spring only converts primitive types to enums using Enum::valueOf, which can prevent
14+
* correct conversion if the OpenAPI specification is using an `enumPropertyNaming` other than
15+
* `original` or the specification has an integer enum.
16+
*/
1017
@Configuration(value = "org.openapitools.configuration.enumConverterConfiguration")
1118
public class EnumConverterConfiguration {
1219

samples/server/petstore/spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
import org.springframework.context.annotation.Configuration;
88
import org.springframework.core.convert.converter.Converter;
99

10+
/**
11+
* This class provides Spring Converter beans for the enum models in the OpenAPI specification.
12+
*
13+
* By default, Spring only converts primitive types to enums using Enum::valueOf, which can prevent
14+
* correct conversion if the OpenAPI specification is using an `enumPropertyNaming` other than
15+
* `original` or the specification has an integer enum.
16+
*/
1017
@Configuration(value = "org.openapitools.configuration.enumConverterConfiguration")
1118
public class EnumConverterConfiguration {
1219

samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
import org.springframework.context.annotation.Configuration;
88
import org.springframework.core.convert.converter.Converter;
99

10+
/**
11+
* This class provides Spring Converter beans for the enum models in the OpenAPI specification.
12+
*
13+
* By default, Spring only converts primitive types to enums using Enum::valueOf, which can prevent
14+
* correct conversion if the OpenAPI specification is using an `enumPropertyNaming` other than
15+
* `original` or the specification has an integer enum.
16+
*/
1017
@Configuration(value = "org.openapitools.configuration.enumConverterConfiguration")
1118
public class EnumConverterConfiguration {
1219

samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
import org.springframework.context.annotation.Configuration;
88
import org.springframework.core.convert.converter.Converter;
99

10+
/**
11+
* This class provides Spring Converter beans for the enum models in the OpenAPI specification.
12+
*
13+
* By default, Spring only converts primitive types to enums using Enum::valueOf, which can prevent
14+
* correct conversion if the OpenAPI specification is using an `enumPropertyNaming` other than
15+
* `original` or the specification has an integer enum.
16+
*/
1017
@Configuration(value = "org.openapitools.configuration.enumConverterConfiguration")
1118
public class EnumConverterConfiguration {
1219

samples/server/petstore/springboot-builtin-validation/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
import org.springframework.context.annotation.Configuration;
88
import org.springframework.core.convert.converter.Converter;
99

10+
/**
11+
* This class provides Spring Converter beans for the enum models in the OpenAPI specification.
12+
*
13+
* By default, Spring only converts primitive types to enums using Enum::valueOf, which can prevent
14+
* correct conversion if the OpenAPI specification is using an `enumPropertyNaming` other than
15+
* `original` or the specification has an integer enum.
16+
*/
1017
@Configuration(value = "org.openapitools.configuration.enumConverterConfiguration")
1118
public class EnumConverterConfiguration {
1219

samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/configuration/EnumConverterConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
import org.springframework.context.annotation.Configuration;
88
import org.springframework.core.convert.converter.Converter;
99

10+
/**
11+
* This class provides Spring Converter beans for the enum models in the OpenAPI specification.
12+
*
13+
* By default, Spring only converts primitive types to enums using Enum::valueOf, which can prevent
14+
* correct conversion if the OpenAPI specification is using an `enumPropertyNaming` other than
15+
* `original` or the specification has an integer enum.
16+
*/
1017
@Configuration(value = "org.openapitools.configuration.enumConverterConfiguration")
1118
public class EnumConverterConfiguration {
1219

0 commit comments

Comments
 (0)