Skip to content

Commit 54e98a5

Browse files
committed
Jersey2/3: Regenerate samples
1 parent 1ffc74c commit 54e98a5

File tree

163 files changed

+2031
-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.

163 files changed

+2031
-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/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,12 @@
302302
<artifactId>jackson-databind-nullable</artifactId>
303303
<version>${jackson-databind-nullable-version}</version>
304304
</dependency>
305+
<!-- XML processing: JAXB -->
306+
<dependency>
307+
<groupId>org.glassfish.jersey.media</groupId>
308+
<artifactId>jersey-media-jaxb</artifactId>
309+
<version>${jersey-version}</version>
310+
</dependency>
305311
<dependency>
306312
<groupId>com.fasterxml.jackson.datatype</groupId>
307313
<artifactId>jackson-datatype-jsr310</artifactId>

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)