diff --git a/bin/configs/spring-mvc.yaml b/bin/configs/spring-mvc.yaml index 8f16468573df..8eca9e650a2b 100644 --- a/bin/configs/spring-mvc.yaml +++ b/bin/configs/spring-mvc.yaml @@ -10,3 +10,4 @@ additionalProperties: hideGenerationTimestamp: "true" serverPort: "8002" additionalModelTypeAnnotations: '@com.fasterxml.jackson.annotation.JsonFilter(value = "filter-name");@com.fasterxml.jackson.annotation.JsonIgnoreProperties(value = "id")' + additionalEnumTypeAnnotations: '@com.fasterxml.jackson.annotation.JsonFormat' diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md index 37a6b5702052..73c3868b1fa6 100644 --- a/docs/generators/groovy.md +++ b/docs/generators/groovy.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |org.openapitools.api| diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md index 11343c569506..b82ecd1964db 100644 --- a/docs/generators/java-inflector.md +++ b/docs/generators/java-inflector.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |org.openapitools.controllers| diff --git a/docs/generators/java-msf4j.md b/docs/generators/java-msf4j.md index f47a113a69a0..afa59addfcb3 100644 --- a/docs/generators/java-msf4j.md +++ b/docs/generators/java-msf4j.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |org.openapitools.api| diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md index 5488b0d7e699..1c457b6afea1 100644 --- a/docs/generators/java-pkmst.md +++ b/docs/generators/java-pkmst.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |com.prokarma.pkmst.controller| diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md index 895b6196e2bb..33cfb5eb89ee 100644 --- a/docs/generators/java-play-framework.md +++ b/docs/generators/java-play-framework.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |controllers| diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md index 4ea7da112015..fa844da00243 100644 --- a/docs/generators/java-undertow-server.md +++ b/docs/generators/java-undertow-server.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |null| diff --git a/docs/generators/java-vertx-web.md b/docs/generators/java-vertx-web.md index 54a3d02e2b87..37ee8e280c6b 100644 --- a/docs/generators/java-vertx-web.md +++ b/docs/generators/java-vertx-web.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |org.openapitools.vertxweb.server.api| diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md index 8ede328f9685..4549726d3546 100644 --- a/docs/generators/java-vertx.md +++ b/docs/generators/java-vertx.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |org.openapitools.server.api.verticle| diff --git a/docs/generators/java.md b/docs/generators/java.md index dd82de49bc42..6aef6a380753 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |org.openapitools.client.api| diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md index 9777fc13a8eb..ef56b4d6ec22 100644 --- a/docs/generators/jaxrs-cxf-cdi.md +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |org.openapitools.api| diff --git a/docs/generators/jaxrs-cxf-client.md b/docs/generators/jaxrs-cxf-client.md index da6c76b914f6..09fd7e6f4063 100644 --- a/docs/generators/jaxrs-cxf-client.md +++ b/docs/generators/jaxrs-cxf-client.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |org.openapitools.api| diff --git a/docs/generators/jaxrs-cxf-extended.md b/docs/generators/jaxrs-cxf-extended.md index 7287ce4c347f..5d0662886fa6 100644 --- a/docs/generators/jaxrs-cxf-extended.md +++ b/docs/generators/jaxrs-cxf-extended.md @@ -8,6 +8,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | |addConsumesProducesJson|Add @Consumes/@Produces Json to API interface| |false| +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |org.openapitools.api| diff --git a/docs/generators/jaxrs-cxf.md b/docs/generators/jaxrs-cxf.md index da94d01c48a5..0a58f4838965 100644 --- a/docs/generators/jaxrs-cxf.md +++ b/docs/generators/jaxrs-cxf.md @@ -8,6 +8,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | |addConsumesProducesJson|Add @Consumes/@Produces Json to API interface| |false| +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |org.openapitools.api| diff --git a/docs/generators/jaxrs-jersey.md b/docs/generators/jaxrs-jersey.md index 77d1306d1d64..664d6ed142c2 100644 --- a/docs/generators/jaxrs-jersey.md +++ b/docs/generators/jaxrs-jersey.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |org.openapitools.api| diff --git a/docs/generators/jaxrs-resteasy-eap.md b/docs/generators/jaxrs-resteasy-eap.md index 9a8b0621cec0..e5247bb5495b 100644 --- a/docs/generators/jaxrs-resteasy-eap.md +++ b/docs/generators/jaxrs-resteasy-eap.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |org.openapitools.api| diff --git a/docs/generators/jaxrs-resteasy.md b/docs/generators/jaxrs-resteasy.md index e2a1dddba4b6..e8a4b7a090cf 100644 --- a/docs/generators/jaxrs-resteasy.md +++ b/docs/generators/jaxrs-resteasy.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |org.openapitools.api| diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index 4312fae456df..4302199f0f55 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |org.openapitools.api| diff --git a/docs/generators/spring.md b/docs/generators/spring.md index f583724fe2c5..b931916c3c81 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | +|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null| |additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiFirst|Generate the API from the OAI spec at server compile time (API first approach)| |false| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index e9a24c9c1030..90dd6b05a989 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -63,6 +63,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code public static final String BOOLEAN_GETTER_PREFIX = "booleanGetterPrefix"; public static final String IGNORE_ANYOF_IN_ENUM = "ignoreAnyOfInEnum"; public static final String ADDITIONAL_MODEL_TYPE_ANNOTATIONS = "additionalModelTypeAnnotations"; + public static final String ADDITIONAL_ENUM_TYPE_ANNOTATIONS = "additionalEnumTypeAnnotations"; public static final String DISCRIMINATOR_CASE_SENSITIVE = "discriminatorCaseSensitive"; public static final String OPENAPI_NULLABLE = "openApiNullable"; @@ -106,6 +107,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code protected String parentVersion = ""; protected boolean parentOverridden = false; protected List additionalModelTypeAnnotations = new LinkedList<>(); + protected List additionalEnumTypeAnnotations = new LinkedList<>(); protected boolean openApiNullable = true; public AbstractJavaCodegen() { @@ -244,6 +246,7 @@ public AbstractJavaCodegen() { cliOptions.add(CliOption.newString(BOOLEAN_GETTER_PREFIX, "Set booleanGetterPrefix").defaultValue(this.getBooleanGetterPrefix())); cliOptions.add(CliOption.newBoolean(IGNORE_ANYOF_IN_ENUM, "Ignore anyOf keyword in enum", ignoreAnyOfInEnum)); cliOptions.add(CliOption.newString(ADDITIONAL_MODEL_TYPE_ANNOTATIONS, "Additional annotations for model type(class level annotations)")); + cliOptions.add(CliOption.newString(ADDITIONAL_ENUM_TYPE_ANNOTATIONS, "Additional annotations for enum type(class level annotations)")); cliOptions.add(CliOption.newBoolean(OPENAPI_NULLABLE, "Enable OpenAPI Jackson Nullable library", this.openApiNullable)); cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC)); @@ -293,6 +296,12 @@ public void processOpts() { this.setAdditionalModelTypeAnnotations(Arrays.asList(additionalAnnotationsList.split(";"))); } + if (additionalProperties.containsKey(ADDITIONAL_ENUM_TYPE_ANNOTATIONS)) { + String additionalAnnotationsList = additionalProperties.get(ADDITIONAL_ENUM_TYPE_ANNOTATIONS).toString(); + + this.setAdditionalEnumTypeAnnotations(Arrays.asList(additionalAnnotationsList.split(";"))); + } + if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); } else if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) { @@ -586,6 +595,13 @@ public Map postProcessAllModels(Map objs) { } } + if (!additionalEnumTypeAnnotations.isEmpty()) { + for (String modelName : objs.keySet()) { + Map models = (Map) objs.get(modelName); + models.put(ADDITIONAL_ENUM_TYPE_ANNOTATIONS, additionalEnumTypeAnnotations); + } + } + return objs; } @@ -1767,6 +1783,10 @@ public void setAdditionalModelTypeAnnotations(final List additionalModel this.additionalModelTypeAnnotations = additionalModelTypeAnnotations; } + public void setAdditionalEnumTypeAnnotations(final List additionalEnumTypeAnnotations) { + this.additionalEnumTypeAnnotations = additionalEnumTypeAnnotations; + } + @Override protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) { if (!supportsAdditionalPropertiesWithComposedSchema) { diff --git a/modules/openapi-generator/src/main/resources/Java/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/Java/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/enumClass.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/enumClass.mustache index 67e776cbf590..87d5ee699a54 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/enumClass.mustache @@ -6,7 +6,7 @@ @JsonbTypeSerializer({{datatypeWithEnum}}.Serializer.class) @JsonbTypeDeserializer({{datatypeWithEnum}}.Deserializer.class) {{/withXml}} - public enum {{datatypeWithEnum}} { + {{>additionalEnumTypeAnnotations}}public enum {{datatypeWithEnum}} { {{#allowableValues}} {{#withXml}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/enumOuterClass.mustache index df2c72873962..c56eca64b1e5 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/enumOuterClass.mustache @@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonValue; /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}}{{#enumVars}} @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) diff --git a/modules/openapi-generator/src/main/resources/Java/modelEnum.mustache b/modules/openapi-generator/src/main/resources/Java/modelEnum.mustache index 10ad58e443b6..207a937ebdea 100644 --- a/modules/openapi-generator/src/main/resources/Java/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/Java/modelEnum.mustache @@ -20,7 +20,7 @@ import com.google.gson.stream.JsonWriter; @JsonbTypeSerializer({{datatypeWithEnum}}.Serializer.class) @JsonbTypeDeserializer({{datatypeWithEnum}}.Deserializer.class) {{/jsonb}} -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#allowableValues}}{{#enumVars}} {{#enumDescription}} /** diff --git a/modules/openapi-generator/src/main/resources/Java/modelInnerEnum.mustache b/modules/openapi-generator/src/main/resources/Java/modelInnerEnum.mustache index 942be42b518e..e0a194d6ba6f 100644 --- a/modules/openapi-generator/src/main/resources/Java/modelInnerEnum.mustache +++ b/modules/openapi-generator/src/main/resources/Java/modelInnerEnum.mustache @@ -12,7 +12,7 @@ @XmlType(name="{{datatypeWithEnum}}") @XmlEnum({{dataType}}.class) {{/withXml}} - public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#allowableValues}} {{#enumVars}} {{#enumDescription}} diff --git a/modules/openapi-generator/src/main/resources/JavaInflector/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaInflector/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaInflector/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaInflector/enumClass.mustache b/modules/openapi-generator/src/main/resources/JavaInflector/enumClass.mustache index 0fe7d8c27b54..49f3cb7922bc 100644 --- a/modules/openapi-generator/src/main/resources/JavaInflector/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaInflector/enumClass.mustache @@ -1,7 +1,7 @@ /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} */ - public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}} {{#enumVars}} diff --git a/modules/openapi-generator/src/main/resources/JavaInflector/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/JavaInflector/enumOuterClass.mustache index 9e032184bedd..123ccb2ca6a2 100644 --- a/modules/openapi-generator/src/main/resources/JavaInflector/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaInflector/enumOuterClass.mustache @@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}}{{#enumVars}} @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/enumClass.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/enumClass.mustache index 2d7d5388cf4b..829a9f6e314f 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/enumClass.mustache @@ -1,6 +1,6 @@ @XmlType(name="{{datatypeWithEnum}}") @XmlEnum({{dataType}}.class) -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#allowableValues}} {{#enumVars}}@XmlEnumValue({{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/enumClass.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/enumClass.mustache index 34b72f9a0574..ea397c86bbf2 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/enumClass.mustache @@ -1,6 +1,6 @@ @XmlType(name="{{datatypeWithEnum}}") @XmlEnum({{dataType}}.class) -public enum {{datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{datatypeWithEnum}} { {{#allowableValues}} {{#enumVars}}@XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) @JsonProperty({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) {{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/enumOuterClass.mustache index 86916472d2de..8d5639a8dec3 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/enumOuterClass.mustache @@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonValue; /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}}{{#enumVars}} @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/enumClass.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/enumClass.mustache index ba65a125104a..f2944aa59137 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/enumClass.mustache @@ -1,6 +1,6 @@ @XmlType(name="{{datatypeWithEnum}}") @XmlEnum({{dataType}}.class) -public enum {{datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{datatypeWithEnum}} { {{#allowableValues}} {{#enumVars}}@XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) {{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/enumOuterClass.mustache index 86916472d2de..8d5639a8dec3 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/enumOuterClass.mustache @@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonValue; /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}}{{#enumVars}} @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/enumClass.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/enumClass.mustache index 67c7fcc52067..579070d66e6b 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/enumClass.mustache @@ -1,7 +1,7 @@ /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ - public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}} {{#enumVars}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/enumOuterClass.mustache index eb063d56c608..84e034d1cf3b 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/enumOuterClass.mustache @@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}}{{#enumVars}} {{#enumDescription}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/modelEnum.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/modelEnum.mustache index 906ebdb28f41..bff968c46894 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/modelEnum.mustache @@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonValue; /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}}{{#enumVars}} @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/enumClass.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/enumClass.mustache index 931d0229c8dc..6e41c39177f6 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/enumClass.mustache @@ -1,7 +1,7 @@ /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ - public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#allowableValues}} {{#enumVars}} {{{name}}}({{{value}}}){{^-last}}, diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/enumOuterClass.mustache index 77ae9521fa51..bd381e5db9a0 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/enumOuterClass.mustache @@ -1,4 +1,4 @@ -public enum {{classname}} { +{{>additionalEnumTypeAnnotations}}public enum {{classname}} { {{#allowableValues}} {{#enumVars}} {{{name}}}{{^-last}},{{/-last}}{{#-last}};{{/-last}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/enumClass.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/enumClass.mustache index 931d0229c8dc..6e41c39177f6 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/enumClass.mustache @@ -1,7 +1,7 @@ /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ - public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#allowableValues}} {{#enumVars}} {{{name}}}({{{value}}}){{^-last}}, diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/enumOuterClass.mustache index 4e2fa16da0fb..9ffe6b07226b 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/enumOuterClass.mustache @@ -1,3 +1,3 @@ -public enum {{classname}} { +{{>additionalEnumTypeAnnotations}}public enum {{classname}} { {{#allowableValues}}{{#enumVars}}{{{name}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}} } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/enumClass.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/enumClass.mustache index 81284b7dd354..9a4bb71d9d75 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/enumClass.mustache @@ -1,4 +1,4 @@ -public enum {{datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{datatypeWithEnum}} { {{#allowableValues}} {{#enumVars}}{{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/enumOuterClass.mustache index 2865cf70cfd9..dd9020ea9b8f 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/enumOuterClass.mustache @@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonValue; /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}}{{#enumVars}} @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) diff --git a/modules/openapi-generator/src/main/resources/JavaPlayFramework/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaPlayFramework/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaPlayFramework/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaPlayFramework/enumClass.mustache b/modules/openapi-generator/src/main/resources/JavaPlayFramework/enumClass.mustache index 211fddf21f4b..0e53213ed49c 100644 --- a/modules/openapi-generator/src/main/resources/JavaPlayFramework/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaPlayFramework/enumClass.mustache @@ -1,7 +1,7 @@ /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} */ - public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}} {{#enumVars}} diff --git a/modules/openapi-generator/src/main/resources/JavaPlayFramework/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/JavaPlayFramework/enumOuterClass.mustache index 91d3edab7b04..29e50e1b428d 100644 --- a/modules/openapi-generator/src/main/resources/JavaPlayFramework/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaPlayFramework/enumOuterClass.mustache @@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}}{{#enumVars}} @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaSpring/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/enumClass.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/enumClass.mustache index c1d813aa8054..35b2bba8f628 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/enumClass.mustache @@ -1,7 +1,7 @@ /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} */ - public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}} {{#enumVars}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/enumOuterClass.mustache index baa6d54d704c..334bfb6640b7 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/enumOuterClass.mustache @@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}}{{#enumVars}} @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) diff --git a/modules/openapi-generator/src/main/resources/JavaVertXServer/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaVertXServer/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaVertXServer/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaVertXServer/enumClass.mustache b/modules/openapi-generator/src/main/resources/JavaVertXServer/enumClass.mustache index 0867107d9930..7adb899f9087 100644 --- a/modules/openapi-generator/src/main/resources/JavaVertXServer/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaVertXServer/enumClass.mustache @@ -1,5 +1,5 @@ - public enum {{{datatypeWithEnum}}} { + {{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}} { {{#allowableValues}}{{#enumVars}}{{{name}}}({{{value}}}){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} diff --git a/modules/openapi-generator/src/main/resources/JavaVertXServer/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/JavaVertXServer/enumOuterClass.mustache index e89caa5a3f20..58748fd18b26 100644 --- a/modules/openapi-generator/src/main/resources/JavaVertXServer/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaVertXServer/enumOuterClass.mustache @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonValue; /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#allowableValues}}{{#enumVars}} {{{name}}}({{{value}}}){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} diff --git a/modules/openapi-generator/src/main/resources/JavaVertXWebServer/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaVertXWebServer/enumClass.mustache b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/enumClass.mustache index 0867107d9930..7adb899f9087 100644 --- a/modules/openapi-generator/src/main/resources/JavaVertXWebServer/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/enumClass.mustache @@ -1,5 +1,5 @@ - public enum {{{datatypeWithEnum}}} { + {{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}} { {{#allowableValues}}{{#enumVars}}{{{name}}}({{{value}}}){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} diff --git a/modules/openapi-generator/src/main/resources/JavaVertXWebServer/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/enumOuterClass.mustache index 97d8170d5f8d..a7b818b228fb 100644 --- a/modules/openapi-generator/src/main/resources/JavaVertXWebServer/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/JavaVertXWebServer/enumOuterClass.mustache @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonValue; /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#allowableValues}}{{#enumVars}} {{{name}}}({{{value}}}){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} diff --git a/modules/openapi-generator/src/main/resources/apex/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/apex/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/apex/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/apex/modelEnum.mustache b/modules/openapi-generator/src/main/resources/apex/modelEnum.mustache index 0de022ce854f..ad4d173fe5da 100644 --- a/modules/openapi-generator/src/main/resources/apex/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/apex/modelEnum.mustache @@ -1,7 +1,7 @@ /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#allowableValues}} {{#enumVars}} {{name}}{{^-last}},{{/-last}} diff --git a/modules/openapi-generator/src/main/resources/apex/modelInnerEnum.mustache b/modules/openapi-generator/src/main/resources/apex/modelInnerEnum.mustache index 8086630e3759..c21dd1e3f0d5 100644 --- a/modules/openapi-generator/src/main/resources/apex/modelInnerEnum.mustache +++ b/modules/openapi-generator/src/main/resources/apex/modelInnerEnum.mustache @@ -1,7 +1,7 @@ /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} */ - public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#allowableValues}} {{#enumVars}} {{{name}}}{{^-last}},{{/-last}} diff --git a/modules/openapi-generator/src/main/resources/java-msf4j-server/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/java-msf4j-server/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-msf4j-server/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-msf4j-server/enumClass.mustache b/modules/openapi-generator/src/main/resources/java-msf4j-server/enumClass.mustache index 0fe7d8c27b54..49f3cb7922bc 100644 --- a/modules/openapi-generator/src/main/resources/java-msf4j-server/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/java-msf4j-server/enumClass.mustache @@ -1,7 +1,7 @@ /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} */ - public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}} {{#enumVars}} diff --git a/modules/openapi-generator/src/main/resources/java-msf4j-server/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/java-msf4j-server/enumOuterClass.mustache index 9e032184bedd..123ccb2ca6a2 100644 --- a/modules/openapi-generator/src/main/resources/java-msf4j-server/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/java-msf4j-server/enumOuterClass.mustache @@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}}{{#enumVars}} @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) diff --git a/modules/openapi-generator/src/main/resources/java-pkmst/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/java-pkmst/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-pkmst/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-pkmst/enumClass.mustache b/modules/openapi-generator/src/main/resources/java-pkmst/enumClass.mustache index 0fe7d8c27b54..49f3cb7922bc 100644 --- a/modules/openapi-generator/src/main/resources/java-pkmst/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/java-pkmst/enumClass.mustache @@ -1,7 +1,7 @@ /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} */ - public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}} {{#enumVars}} diff --git a/modules/openapi-generator/src/main/resources/java-pkmst/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/java-pkmst/enumOuterClass.mustache index 9e032184bedd..123ccb2ca6a2 100644 --- a/modules/openapi-generator/src/main/resources/java-pkmst/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/java-pkmst/enumOuterClass.mustache @@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}}{{#enumVars}} @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/additionalEnumTypeAnnotations.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/additionalEnumTypeAnnotations.mustache new file mode 100644 index 000000000000..aa524798b425 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/enumClass.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/enumClass.mustache index 0867107d9930..7adb899f9087 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/enumClass.mustache @@ -1,5 +1,5 @@ - public enum {{{datatypeWithEnum}}} { + {{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}} { {{#allowableValues}}{{#enumVars}}{{{name}}}({{{value}}}){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/enumOuterClass.mustache index f2805b0f72a3..fef5b45d127a 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/enumOuterClass.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/enumOuterClass.mustache @@ -5,7 +5,7 @@ /** * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} */ -public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { +{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#gson}} {{#allowableValues}}{{#enumVars}} @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCat.java index 88cda0d197dd..b6edd21f6d93 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCat.java @@ -22,7 +22,8 @@ public class BigCat extends Cat { /** * Gets or Sets kind */ - public enum KindEnum { + @com.fasterxml.jackson.annotation.JsonFormat +public enum KindEnum { LIONS("lions"), TIGERS("tigers"), diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCatAllOf.java index 9c60baa174f9..8875754744fe 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCatAllOf.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCatAllOf.java @@ -20,7 +20,8 @@ public class BigCatAllOf { /** * Gets or Sets kind */ - public enum KindEnum { + @com.fasterxml.jackson.annotation.JsonFormat +public enum KindEnum { LIONS("lions"), TIGERS("tigers"), diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumArrays.java index 618b78fcbc5a..0fb3e1449707 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumArrays.java @@ -22,7 +22,8 @@ public class EnumArrays { /** * Gets or Sets justSymbol */ - public enum JustSymbolEnum { + @com.fasterxml.jackson.annotation.JsonFormat +public enum JustSymbolEnum { GREATER_THAN_OR_EQUAL_TO(">="), DOLLAR("$"); @@ -60,7 +61,8 @@ public static JustSymbolEnum fromValue(String value) { /** * Gets or Sets arrayEnum */ - public enum ArrayEnumEnum { + @com.fasterxml.jackson.annotation.JsonFormat +public enum ArrayEnumEnum { FISH("fish"), CRAB("crab"); diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumClass.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumClass.java index ef4719c757f0..9575f4c28f32 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumClass.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumClass.java @@ -11,6 +11,7 @@ /** * Gets or Sets EnumClass */ +@com.fasterxml.jackson.annotation.JsonFormat public enum EnumClass { _ABC("_abc"), diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumTest.java index cab39af5a28a..b10549a94905 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumTest.java @@ -21,7 +21,8 @@ public class EnumTest { /** * Gets or Sets enumString */ - public enum EnumStringEnum { + @com.fasterxml.jackson.annotation.JsonFormat +public enum EnumStringEnum { UPPER("UPPER"), LOWER("lower"), @@ -61,7 +62,8 @@ public static EnumStringEnum fromValue(String value) { /** * Gets or Sets enumStringRequired */ - public enum EnumStringRequiredEnum { + @com.fasterxml.jackson.annotation.JsonFormat +public enum EnumStringRequiredEnum { UPPER("UPPER"), LOWER("lower"), @@ -101,7 +103,8 @@ public static EnumStringRequiredEnum fromValue(String value) { /** * Gets or Sets enumInteger */ - public enum EnumIntegerEnum { + @com.fasterxml.jackson.annotation.JsonFormat +public enum EnumIntegerEnum { NUMBER_1(1), NUMBER_MINUS_1(-1); @@ -139,7 +142,8 @@ public static EnumIntegerEnum fromValue(Integer value) { /** * Gets or Sets enumNumber */ - public enum EnumNumberEnum { + @com.fasterxml.jackson.annotation.JsonFormat +public enum EnumNumberEnum { NUMBER_1_DOT_1(1.1), NUMBER_MINUS_1_DOT_2(-1.2); diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/MapTest.java index fbb4966cc6ca..7e43d87491dc 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/MapTest.java @@ -27,7 +27,8 @@ public class MapTest { /** * Gets or Sets inner */ - public enum InnerEnum { + @com.fasterxml.jackson.annotation.JsonFormat +public enum InnerEnum { UPPER("UPPER"), LOWER("lower"); diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Order.java index c10da34792ca..a4575fdf1d85 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Order.java @@ -34,7 +34,8 @@ public class Order { /** * Order Status */ - public enum StatusEnum { + @com.fasterxml.jackson.annotation.JsonFormat +public enum StatusEnum { PLACED("placed"), APPROVED("approved"), diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/OuterEnum.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/OuterEnum.java index 6b5abc576b07..aa1dd337f5dd 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/OuterEnum.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/OuterEnum.java @@ -11,6 +11,7 @@ /** * Gets or Sets OuterEnum */ +@com.fasterxml.jackson.annotation.JsonFormat public enum OuterEnum { PLACED("placed"), diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Pet.java index 1c2cd719532a..06647f494bcb 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Pet.java @@ -43,7 +43,8 @@ public class Pet { /** * pet status in the store */ - public enum StatusEnum { + @com.fasterxml.jackson.annotation.JsonFormat +public enum StatusEnum { AVAILABLE("available"), PENDING("pending"),