Skip to content

Commit ec8ca20

Browse files
authored
[Java] Support Deprecation of Generated enum-classes (#22312)
* [Java] Annotate Deprecated `enum`-classes with `@Deprecated` * Update Generated 'samples'-files Signed-off-by: Chrimle <[email protected]> * Update `modelEnum.mustache` According to Review Comment Signed-off-by: Chrimle <[email protected]> * Update Generated 'sample'-files Signed-off-by: Chrimle <[email protected]> * Update Java Native `modelEnum.mustache` File Signed-off-by: Chrimle <[email protected]> * Update Java JaxRS `modelEnum.mustache` File Signed-off-by: Chrimle <[email protected]> * Update Java Okhttp-gson `modelEnum.mustache` File Signed-off-by: Chrimle <[email protected]> * Update Java Micronaut `modelEnum.mustache` File Signed-off-by: Chrimle <[email protected]> * Update Java Helidon `modelEnum.mustache` File Signed-off-by: Chrimle <[email protected]> --------- Signed-off-by: Chrimle <[email protected]>
1 parent 2ab5365 commit ec8ca20

File tree

6 files changed

+18
-0
lines changed

6 files changed

+18
-0
lines changed

modules/openapi-generator/src/main/resources/Java/libraries/native/modelEnum.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ import java.util.Locale;
1717
/**
1818
* {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
1919
*/
20+
{{#isDeprecated}}
21+
@Deprecated
22+
{{/isDeprecated}}
2023
{{#gson}}
2124
@JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Adapter.class)
2225
{{/gson}}

modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/modelEnum.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import com.google.gson.stream.JsonWriter;
1212
/**
1313
* {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
1414
*/
15+
{{#isDeprecated}}
16+
@Deprecated
17+
{{/isDeprecated}}
1518
@JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Adapter.class)
1619
{{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}{{#vendorExtensions.x-implements}}{{#-first}} implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} {
1720
{{#allowableValues}}{{#enumVars}}

modules/openapi-generator/src/main/resources/Java/modelEnum.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ import java.util.Locale;
1717
/**
1818
* {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
1919
*/
20+
{{#isDeprecated}}
21+
@Deprecated
22+
{{/isDeprecated}}
2023
{{#gson}}
2124
@JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Adapter.class)
2225
{{/gson}}

modules/openapi-generator/src/main/resources/JavaJaxRS/modelEnum.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import com.fasterxml.jackson.annotation.JsonValue;
66
/**
77
* {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
88
*/
9+
{{#isDeprecated}}
10+
@Deprecated
11+
{{/isDeprecated}}
912
{{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
1013
{{#gson}}
1114
{{#allowableValues}}{{#enumVars}}

modules/openapi-generator/src/main/resources/java-helidon/server/libraries/mp/modelEnum.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/**
22
* {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
33
*/
4+
{{#isDeprecated}}
5+
@Deprecated
6+
{{/isDeprecated}}
47
{{#jsonb}}
58
@JsonbTypeSerializer({{datatypeWithEnum}}.Serializer.class)
69
@JsonbTypeDeserializer({{datatypeWithEnum}}.Deserializer.class)

modules/openapi-generator/src/main/resources/java-micronaut/common/model/modelEnum.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import com.fasterxml.jackson.annotation.JsonValue;
66
/**
77
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
88
*/
9+
{{#isDeprecated}}
10+
@Deprecated
11+
{{/isDeprecated}}
912
{{#additionalEnumTypeAnnotations}}
1013
{{{.}}}
1114
{{/additionalEnumTypeAnnotations}}{{#useBeanValidation}}@Introspected

0 commit comments

Comments
 (0)