Skip to content

Commit d6991eb

Browse files
committed
Jersey2/3: Regenerate samples
1 parent b7cd42a commit d6991eb

File tree

212 files changed

+2916
-128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+2916
-128
lines changed

samples/client/others/java/jersey2-oneOf-Mixed/src/main/java/org/openapitools/client/ApiClient.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import java.util.LinkedHashMap;
6060
import java.util.LinkedHashSet;
6161
import java.util.List;
62+
import java.util.Set;
6263
import java.util.Arrays;
6364
import java.util.ArrayList;
6465
import java.util.Date;
@@ -700,8 +701,7 @@ public boolean isJsonMime(String mime) {
700701

701702
/**
702703
* Select the Accept header's value from the given accepts array:
703-
* if JSON exists in the given array, use it;
704-
* otherwise use all of them (joining into a string)
704+
* if JSON exists in the given array, makes sure there is only one entry of it.
705705
*
706706
* @param accepts The accepts array to select from
707707
* @return The Accept header to use. If the given array is empty,
@@ -711,12 +711,19 @@ public String selectHeaderAccept(String... accepts) {
711711
if (accepts == null || accepts.length == 0) {
712712
return null;
713713
}
714+
Set<String> acceptHeaders = new LinkedHashSet<>();
715+
boolean foundJsonMime = false;
714716
for (String accept : accepts) {
715717
if (isJsonMime(accept)) {
716-
return accept;
718+
if (foundJsonMime) {
719+
continue;
720+
} else {
721+
foundJsonMime = true;
722+
}
717723
}
724+
acceptHeaders.add(accept);
718725
}
719-
return StringUtil.join(accepts, ",");
726+
return StringUtil.join(acceptHeaders, ",");
720727
}
721728

722729
/**

samples/client/others/java/jersey2-oneOf-duplicates/src/main/java/org/openapitools/client/ApiClient.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import java.util.LinkedHashMap;
6060
import java.util.LinkedHashSet;
6161
import java.util.List;
62+
import java.util.Set;
6263
import java.util.Arrays;
6364
import java.util.ArrayList;
6465
import java.util.Date;
@@ -700,8 +701,7 @@ public boolean isJsonMime(String mime) {
700701

701702
/**
702703
* Select the Accept header's value from the given accepts array:
703-
* if JSON exists in the given array, use it;
704-
* otherwise use all of them (joining into a string)
704+
* if JSON exists in the given array, makes sure there is only one entry of it.
705705
*
706706
* @param accepts The accepts array to select from
707707
* @return The Accept header to use. If the given array is empty,
@@ -711,12 +711,19 @@ public String selectHeaderAccept(String... accepts) {
711711
if (accepts == null || accepts.length == 0) {
712712
return null;
713713
}
714+
Set<String> acceptHeaders = new LinkedHashSet<>();
715+
boolean foundJsonMime = false;
714716
for (String accept : accepts) {
715717
if (isJsonMime(accept)) {
716-
return accept;
718+
if (foundJsonMime) {
719+
continue;
720+
} else {
721+
foundJsonMime = true;
722+
}
717723
}
724+
acceptHeaders.add(accept);
718725
}
719-
return StringUtil.join(accepts, ",");
726+
return StringUtil.join(acceptHeaders, ",");
720727
}
721728

722729
/**

samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import java.util.LinkedHashMap;
6161
import java.util.LinkedHashSet;
6262
import java.util.List;
63+
import java.util.Set;
6364
import java.util.Arrays;
6465
import java.util.ArrayList;
6566
import java.util.Date;
@@ -841,8 +842,7 @@ public boolean isJsonMime(String mime) {
841842

842843
/**
843844
* Select the Accept header's value from the given accepts array:
844-
* if JSON exists in the given array, use it;
845-
* otherwise use all of them (joining into a string)
845+
* if JSON exists in the given array, makes sure there is only one entry of it.
846846
*
847847
* @param accepts The accepts array to select from
848848
* @return The Accept header to use. If the given array is empty,
@@ -852,12 +852,19 @@ public String selectHeaderAccept(String... accepts) {
852852
if (accepts == null || accepts.length == 0) {
853853
return null;
854854
}
855+
Set<String> acceptHeaders = new LinkedHashSet<>();
856+
boolean foundJsonMime = false;
855857
for (String accept : accepts) {
856858
if (isJsonMime(accept)) {
857-
return accept;
859+
if (foundJsonMime) {
860+
continue;
861+
} else {
862+
foundJsonMime = true;
863+
}
858864
}
865+
acceptHeaders.add(accept);
859866
}
860-
return StringUtil.join(accepts, ",");
867+
return StringUtil.join(acceptHeaders, ",");
861868
}
862869

863870
/**

samples/client/petstore/java/jersey2-java8/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ ext {
105105
jersey_version = "2.35"
106106
junit_version = "5.8.2"
107107
scribejava_apis_version = "8.3.1"
108+
jaxb_version = "2.3.9"
108109
}
109110

110111
dependencies {
@@ -117,6 +118,11 @@ dependencies {
117118
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
118119
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
119120
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
121+
implementation "org.glassfish.jersey.media:jersey-media-jaxb:$jersey_version"
122+
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_databind_version"
123+
if (JavaVersion.current().isJava11Compatible()) {
124+
implementation "org.glassfish.jaxb:jaxb-runtime:$jaxb_version"
125+
}
120126
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
121127
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
122128
implementation "com.github.scribejava:scribejava-apis:$scribejava_apis_version"

samples/client/petstore/java/jersey2-java8/pom.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,21 @@
248248
</plugins>
249249
</build>
250250
</profile>
251+
<profile>
252+
<id>jaxb-runtime</id>
253+
<activation>
254+
<jdk>
255+
[11,)
256+
</jdk>
257+
</activation>
258+
<dependencies>
259+
<dependency>
260+
<groupId>org.glassfish.jaxb</groupId>
261+
<artifactId>jaxb-runtime</artifactId>
262+
<version>${jaxb-version}</version>
263+
</dependency>
264+
</dependencies>
265+
</profile>
251266
</profiles>
252267

253268
<dependencies>
@@ -302,6 +317,19 @@
302317
<artifactId>jackson-databind-nullable</artifactId>
303318
<version>${jackson-databind-nullable-version}</version>
304319
</dependency>
320+
<!-- XML processing: JAXB -->
321+
<dependency>
322+
<groupId>org.glassfish.jersey.media</groupId>
323+
<artifactId>jersey-media-jaxb</artifactId>
324+
<version>${jersey-version}</version>
325+
</dependency>
326+
<!-- Also requires Jackson XML dataformat due to @JacksonXml*-annotations -->
327+
<dependency>
328+
<groupId>com.fasterxml.jackson.dataformat</groupId>
329+
<artifactId>jackson-dataformat-xml</artifactId>
330+
<!-- Jackson's databind and dataformat libraries seem to be released synchronously -->
331+
<version>${jackson-databind-version}</version>
332+
</dependency>
305333
<dependency>
306334
<groupId>com.fasterxml.jackson.datatype</groupId>
307335
<artifactId>jackson-datatype-jsr310</artifactId>
@@ -340,6 +368,7 @@
340368
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
341369
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
342370
<beanvalidation-version>2.0.2</beanvalidation-version>
371+
<jaxb-version>2.3.9</jaxb-version>
343372
<junit-version>5.10.0</junit-version>
344373
<scribejava-apis-version>8.3.3</scribejava-apis-version>
345374
<spotless.version>2.21.0</spotless.version>

samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import java.util.LinkedHashMap;
6161
import java.util.LinkedHashSet;
6262
import java.util.List;
63+
import java.util.Set;
6364
import java.util.Arrays;
6465
import java.util.ArrayList;
6566
import java.util.Date;
@@ -841,8 +842,7 @@ public boolean isJsonMime(String mime) {
841842

842843
/**
843844
* Select the Accept header's value from the given accepts array:
844-
* if JSON exists in the given array, use it;
845-
* otherwise use all of them (joining into a string)
845+
* if JSON exists in the given array, makes sure there is only one entry of it.
846846
*
847847
* @param accepts The accepts array to select from
848848
* @return The Accept header to use. If the given array is empty,
@@ -852,12 +852,19 @@ public String selectHeaderAccept(String... accepts) {
852852
if (accepts == null || accepts.length == 0) {
853853
return null;
854854
}
855+
Set<String> acceptHeaders = new LinkedHashSet<>();
856+
boolean foundJsonMime = false;
855857
for (String accept : accepts) {
856858
if (isJsonMime(accept)) {
857-
return accept;
859+
if (foundJsonMime) {
860+
continue;
861+
} else {
862+
foundJsonMime = true;
863+
}
858864
}
865+
acceptHeaders.add(accept);
859866
}
860-
return StringUtil.join(accepts, ",");
867+
return StringUtil.join(acceptHeaders, ",");
861868
}
862869

863870
/**

samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import com.fasterxml.jackson.annotation.JsonValue;
2929
import java.util.Arrays;
3030
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
31+
import com.fasterxml.jackson.dataformat.xml.annotation.*;
32+
import javax.xml.bind.annotation.*;
3133
import org.openapitools.client.JSON;
3234

3335

@@ -38,8 +40,12 @@
3840
AdditionalPropertiesAnyType.JSON_PROPERTY_NAME
3941
})
4042
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT")
43+
@XmlRootElement(name = "AdditionalPropertiesAnyType")
44+
@XmlAccessorType(XmlAccessType.FIELD)
45+
@JacksonXmlRootElement(localName = "AdditionalPropertiesAnyType")
4146
public class AdditionalPropertiesAnyType {
4247
public static final String JSON_PROPERTY_NAME = "name";
48+
@XmlElement(name = "name")
4349
@javax.annotation.Nullable
4450
private String name;
4551

@@ -58,6 +64,7 @@ public AdditionalPropertiesAnyType name(@javax.annotation.Nullable String name)
5864
@javax.annotation.Nullable
5965
@JsonProperty(value = JSON_PROPERTY_NAME, required = false)
6066
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
67+
@JacksonXmlProperty(localName = "name")
6168

6269
public String getName() {
6370
return name;
@@ -66,6 +73,7 @@ public String getName() {
6673

6774
@JsonProperty(value = JSON_PROPERTY_NAME, required = false)
6875
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
76+
@JacksonXmlProperty(localName = "name")
6977
public void setName(@javax.annotation.Nullable String name) {
7078
this.name = name;
7179
}

samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import java.util.Arrays;
3030
import java.util.List;
3131
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
32+
import com.fasterxml.jackson.dataformat.xml.annotation.*;
33+
import javax.xml.bind.annotation.*;
3234
import org.openapitools.client.JSON;
3335

3436

@@ -39,8 +41,12 @@
3941
AdditionalPropertiesArray.JSON_PROPERTY_NAME
4042
})
4143
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT")
44+
@XmlRootElement(name = "AdditionalPropertiesArray")
45+
@XmlAccessorType(XmlAccessType.FIELD)
46+
@JacksonXmlRootElement(localName = "AdditionalPropertiesArray")
4247
public class AdditionalPropertiesArray {
4348
public static final String JSON_PROPERTY_NAME = "name";
49+
@XmlElement(name = "name")
4450
@javax.annotation.Nullable
4551
private String name;
4652

@@ -59,6 +65,7 @@ public AdditionalPropertiesArray name(@javax.annotation.Nullable String name) {
5965
@javax.annotation.Nullable
6066
@JsonProperty(value = JSON_PROPERTY_NAME, required = false)
6167
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
68+
@JacksonXmlProperty(localName = "name")
6269

6370
public String getName() {
6471
return name;
@@ -67,6 +74,7 @@ public String getName() {
6774

6875
@JsonProperty(value = JSON_PROPERTY_NAME, required = false)
6976
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
77+
@JacksonXmlProperty(localName = "name")
7078
public void setName(@javax.annotation.Nullable String name) {
7179
this.name = name;
7280
}

samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import com.fasterxml.jackson.annotation.JsonValue;
2929
import java.util.Arrays;
3030
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
31+
import com.fasterxml.jackson.dataformat.xml.annotation.*;
32+
import javax.xml.bind.annotation.*;
3133
import org.openapitools.client.JSON;
3234

3335

@@ -38,8 +40,12 @@
3840
AdditionalPropertiesBoolean.JSON_PROPERTY_NAME
3941
})
4042
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT")
43+
@XmlRootElement(name = "AdditionalPropertiesBoolean")
44+
@XmlAccessorType(XmlAccessType.FIELD)
45+
@JacksonXmlRootElement(localName = "AdditionalPropertiesBoolean")
4146
public class AdditionalPropertiesBoolean {
4247
public static final String JSON_PROPERTY_NAME = "name";
48+
@XmlElement(name = "name")
4349
@javax.annotation.Nullable
4450
private String name;
4551

@@ -58,6 +64,7 @@ public AdditionalPropertiesBoolean name(@javax.annotation.Nullable String name)
5864
@javax.annotation.Nullable
5965
@JsonProperty(value = JSON_PROPERTY_NAME, required = false)
6066
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
67+
@JacksonXmlProperty(localName = "name")
6168

6269
public String getName() {
6370
return name;
@@ -66,6 +73,7 @@ public String getName() {
6673

6774
@JsonProperty(value = JSON_PROPERTY_NAME, required = false)
6875
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
76+
@JacksonXmlProperty(localName = "name")
6977
public void setName(@javax.annotation.Nullable String name) {
7078
this.name = name;
7179
}

0 commit comments

Comments
 (0)