Skip to content

Commit e20e33f

Browse files
committed
Jersey2/3: Regenerate samples
1 parent b2ad28f commit e20e33f

File tree

165 files changed

+2089
-100
lines changed

Some content is hidden

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

165 files changed

+2089
-100
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/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/jersey3-oneOf/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/jersey3/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ ext {
109109
scribejava_apis_version = "8.3.1"
110110
tomitribe_http_signatures_version = "1.7"
111111
commons_lang3_version = "3.17.0"
112+
jaxb_version = "4.0.6"
112113
}
113114

114115
dependencies {
@@ -122,6 +123,11 @@ dependencies {
122123
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
123124
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
124125
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
126+
implementation "org.glassfish.jersey.media:jersey-media-jaxb:$jersey_version"
127+
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_databind_version"
128+
if (JavaVersion.current().isJava11Compatible()) {
129+
implementation "org.glassfish.jaxb:jaxb-runtime:$jaxb_version"
130+
}
125131
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
126132
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
127133
implementation "com.github.scribejava:scribejava-apis:$scribejava_apis_version"

samples/client/petstore/java/jersey3/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>
@@ -358,6 +386,7 @@
358386
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
359387
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
360388
<beanvalidation-version>3.0.2</beanvalidation-version>
389+
<jaxb-version>4.0.6</jaxb-version>
361390
<junit-version>5.10.0</junit-version>
362391
<http-signature-version>1.8</http-signature-version>
363392
<scribejava-apis-version>8.3.3</scribejava-apis-version>

samples/client/petstore/java/jersey3/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;
@@ -923,8 +924,7 @@ public boolean isJsonMime(String mime) {
923924

924925
/**
925926
* Select the Accept header's value from the given accepts array:
926-
* if JSON exists in the given array, use it;
927-
* otherwise use all of them (joining into a string)
927+
* if JSON exists in the given array, makes sure there is only one entry of it.
928928
*
929929
* @param accepts The accepts array to select from
930930
* @return The Accept header to use. If the given array is empty,
@@ -934,12 +934,19 @@ public String selectHeaderAccept(String... accepts) {
934934
if (accepts == null || accepts.length == 0) {
935935
return null;
936936
}
937+
Set<String> acceptHeaders = new LinkedHashSet<>();
938+
boolean foundJsonMime = false;
937939
for (String accept : accepts) {
938940
if (isJsonMime(accept)) {
939-
return accept;
941+
if (foundJsonMime) {
942+
continue;
943+
} else {
944+
foundJsonMime = true;
945+
}
940946
}
947+
acceptHeaders.add(accept);
941948
}
942-
return StringUtil.join(accepts, ",");
949+
return StringUtil.join(acceptHeaders, ",");
943950
}
944951

945952
/**

0 commit comments

Comments
 (0)