forked from loafle/openapi-generator-original
[Java][Microprofile] JSON enum processing fix (#6700)
* When withXml=false we shouldn't add the jaxb imports When users are just dealing with json and set withXml=false jaxb (Java Api XML binding) imports are not needed. * Updated the microprodile-rest-client samples * Removed cxf-rt-rs-extension-providers dependency * Fix processing of enum values * Remove unwanted changes * Remove spaces
This commit is contained in:
parent
efafc58170
commit
4bb5afdefb
@ -75,12 +75,14 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{#serializ
|
||||
{{#vendorExtensions.x-extra-annotation}}
|
||||
{{{vendorExtensions.x-extra-annotation}}}
|
||||
{{/vendorExtensions.x-extra-annotation}}
|
||||
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} {{#isEnum}}{{^isListContainer}}{{^isMapContainer}}public {{dataType}} {{getter}}() {
|
||||
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} {{#withXml}}{{#isEnum}}{{^isListContainer}}{{^isMapContainer}}public {{dataType}} {{getter}}() {
|
||||
if ({{name}} == null) {
|
||||
return null;
|
||||
}
|
||||
return {{name}}.value();
|
||||
}{{/isMapContainer}}{{/isListContainer}}{{/isEnum}}{{#isEnum}}{{#isListContainer}}public {{{datatypeWithEnum}}} {{getter}}() {
|
||||
}{{/isMapContainer}}{{/isListContainer}}{{/isEnum}}{{/withXml}}{{^withXml}}{{#isEnum}}{{^isListContainer}}{{^isMapContainer}}public {{datatypeWithEnum}} {{getter}}() {
|
||||
return {{name}};
|
||||
}{{/isMapContainer}}{{/isListContainer}}{{/isEnum}}{{/withXml}}{{#isEnum}}{{#isListContainer}}public {{{datatypeWithEnum}}} {{getter}}() {
|
||||
return {{name}};
|
||||
}{{/isListContainer}}{{/isEnum}}{{#isEnum}}{{#isMapContainer}}public {{{datatypeWithEnum}}} {{getter}}() {
|
||||
return {{name}};
|
||||
|
@ -88,7 +88,6 @@
|
||||
<version>1.3.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
{{^disableMultipart}}
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
@ -96,7 +95,6 @@
|
||||
<version>3.2.6</version>
|
||||
</dependency>
|
||||
{{/disableMultipart}}
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.json.bind</groupId>
|
||||
<artifactId>javax.json.bind-api</artifactId>
|
||||
|
@ -77,13 +77,11 @@
|
||||
<version>1.3.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-rs-extension-providers</artifactId>
|
||||
<version>3.2.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.json.bind</groupId>
|
||||
<artifactId>javax.json.bind-api</artifactId>
|
||||
|
@ -188,11 +188,8 @@ PLACED(String.valueOf("placed")), APPROVED(String.valueOf("approved")), DELIVERE
|
||||
* @return status
|
||||
**/
|
||||
@JsonbProperty("status")
|
||||
public String getStatus() {
|
||||
if (status == null) {
|
||||
return null;
|
||||
}
|
||||
return status.value();
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -222,11 +222,8 @@ AVAILABLE(String.valueOf("available")), PENDING(String.valueOf("pending")), SOLD
|
||||
* @return status
|
||||
**/
|
||||
@JsonbProperty("status")
|
||||
public String getStatus() {
|
||||
if (status == null) {
|
||||
return null;
|
||||
}
|
||||
return status.value();
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user