Skip to content

Commit 75f8482

Browse files
committed
Jersey2/3: Regenerate samples
1 parent cccdfd2 commit 75f8482

File tree

11 files changed

+121
-44
lines changed
  • samples
    • client
      • others/java
        • jersey2-oneOf-Mixed/src/main/java/org/openapitools/client
        • jersey2-oneOf-duplicates/src/main/java/org/openapitools/client
      • petstore/java
    • openapi3/client
      • extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client
      • petstore/java
        • jersey2-java8-special-characters/src/main/java/org/openapitools/client
        • jersey2-java8-swagger1/src/main/java/org/openapitools/client
        • jersey2-java8-swagger2/src/main/java/org/openapitools/client
        • jersey2-java8/src/main/java/org/openapitools/client

11 files changed

+121
-44
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/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
/**

samples/openapi3/client/extensions/x-auth-id-alias/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
@@ -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;
@@ -749,8 +750,7 @@ public boolean isJsonMime(String mime) {
749750

750751
/**
751752
* Select the Accept header's value from the given accepts array:
752-
* if JSON exists in the given array, use it;
753-
* otherwise use all of them (joining into a string)
753+
* if JSON exists in the given array, makes sure there is only one entry of it.
754754
*
755755
* @param accepts The accepts array to select from
756756
* @return The Accept header to use. If the given array is empty,
@@ -760,12 +760,19 @@ public String selectHeaderAccept(String... accepts) {
760760
if (accepts == null || accepts.length == 0) {
761761
return null;
762762
}
763+
Set<String> acceptHeaders = new LinkedHashSet<>();
764+
boolean foundJsonMime = false;
763765
for (String accept : accepts) {
764766
if (isJsonMime(accept)) {
765-
return accept;
767+
if (foundJsonMime) {
768+
continue;
769+
} else {
770+
foundJsonMime = true;
771+
}
766772
}
773+
acceptHeaders.add(accept);
767774
}
768-
return StringUtil.join(accepts, ",");
775+
return StringUtil.join(acceptHeaders, ",");
769776
}
770777

771778
/**

samples/openapi3/client/petstore/java/jersey2-java8-special-characters/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/openapi3/client/petstore/java/jersey2-java8-swagger1/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;
@@ -825,8 +826,7 @@ public boolean isJsonMime(String mime) {
825826

826827
/**
827828
* Select the Accept header's value from the given accepts array:
828-
* if JSON exists in the given array, use it;
829-
* otherwise use all of them (joining into a string)
829+
* if JSON exists in the given array, makes sure there is only one entry of it.
830830
*
831831
* @param accepts The accepts array to select from
832832
* @return The Accept header to use. If the given array is empty,
@@ -836,12 +836,19 @@ public String selectHeaderAccept(String... accepts) {
836836
if (accepts == null || accepts.length == 0) {
837837
return null;
838838
}
839+
Set<String> acceptHeaders = new LinkedHashSet<>();
840+
boolean foundJsonMime = false;
839841
for (String accept : accepts) {
840842
if (isJsonMime(accept)) {
841-
return accept;
843+
if (foundJsonMime) {
844+
continue;
845+
} else {
846+
foundJsonMime = true;
847+
}
842848
}
849+
acceptHeaders.add(accept);
843850
}
844-
return StringUtil.join(accepts, ",");
851+
return StringUtil.join(acceptHeaders, ",");
845852
}
846853

847854
/**

samples/openapi3/client/petstore/java/jersey2-java8-swagger2/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;
@@ -825,8 +826,7 @@ public boolean isJsonMime(String mime) {
825826

826827
/**
827828
* Select the Accept header's value from the given accepts array:
828-
* if JSON exists in the given array, use it;
829-
* otherwise use all of them (joining into a string)
829+
* if JSON exists in the given array, makes sure there is only one entry of it.
830830
*
831831
* @param accepts The accepts array to select from
832832
* @return The Accept header to use. If the given array is empty,
@@ -836,12 +836,19 @@ public String selectHeaderAccept(String... accepts) {
836836
if (accepts == null || accepts.length == 0) {
837837
return null;
838838
}
839+
Set<String> acceptHeaders = new LinkedHashSet<>();
840+
boolean foundJsonMime = false;
839841
for (String accept : accepts) {
840842
if (isJsonMime(accept)) {
841-
return accept;
843+
if (foundJsonMime) {
844+
continue;
845+
} else {
846+
foundJsonMime = true;
847+
}
842848
}
849+
acceptHeaders.add(accept);
843850
}
844-
return StringUtil.join(accepts, ",");
851+
return StringUtil.join(acceptHeaders, ",");
845852
}
846853

847854
/**

0 commit comments

Comments
 (0)