diff --git a/bin/jaxrs-cxf-cdi-petstore-server.sh b/bin/jaxrs-cxf-cdi-petstore-server.sh index bd7fc1e60897..1ff2155c9010 100755 --- a/bin/jaxrs-cxf-cdi-petstore-server.sh +++ b/bin/jaxrs-cxf-cdi-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l jaxrs-cxf-cdi -o samples/server/petstore/jaxrs-cxf-cdi -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l jaxrs-cxf-cdi -o samples/server/petstore/jaxrs-cxf-cdi -DhideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags 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 587c6a00fdd6..c72204fef1aa 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}} { +public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { {{#allowableValues}} {{#enumVars}}@XmlEnumValue({{{value}}}) {{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}} @@ -9,7 +9,7 @@ public enum {{datatypeWithEnum}} { private {{dataType}} value; - {{datatypeWithEnum}} ({{dataType}} v) { + {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{dataType}} v) { value = v; } @@ -22,7 +22,7 @@ public enum {{datatypeWithEnum}} { return String.valueOf(value); } - public static {{datatypeWithEnum}} fromValue(String v) { + public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String v) { for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { if (String.valueOf(b.value).equals(v)) { return b; diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/enumOuterClass.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/enumOuterClass.mustache new file mode 100644 index 000000000000..896e4db1a383 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/enumOuterClass.mustache @@ -0,0 +1,5 @@ +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; + +{{>enumClass}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/model.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/model.mustache index 225cfd719cc9..8b8dab6b0dbd 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/model.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi/model.mustache @@ -10,7 +10,7 @@ import javax.validation.constraints.*; /** * {{description}} **/{{/description}} -{{#isEnum}}{{>enumClass}}{{/isEnum}} +{{#isEnum}}{{>enumOuterClass}}{{/isEnum}} {{^isEnum}}{{>pojo}}{{/isEnum}} {{/model}} {{/models}} diff --git a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Order.java index 7bc6a61ecdb2..ccb1ffdbba30 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Order.java @@ -36,7 +36,7 @@ public enum StatusEnum { private String value; - StatusEnum (String v) { + StatusEnum(String v) { value = v; } diff --git a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Pet.java index 32e0792a7985..406b5b81071e 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Pet.java @@ -42,7 +42,7 @@ public enum StatusEnum { private String value; - StatusEnum (String v) { + StatusEnum(String v) { value = v; }