Merge remote-tracking branch 'origin' into 7.0.x

This commit is contained in:
William Cheng
2023-03-03 21:52:50 +08:00
10595 changed files with 418520 additions and 73194 deletions

View File

@@ -142,12 +142,6 @@ Class | Method | HTTP request | Description
## Documentation for Authorization
Authentication schemes defined for the API:
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
### petstore_auth
- **Type**: OAuth
@@ -157,6 +151,12 @@ Authentication schemes defined for the API:
- write:pets: modify pets in your account
- read:pets: read your pets
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
## Recommendation

View File

@@ -114,7 +114,7 @@ dependencies {
implementation 'io.gsonfire:gson-fire:1.8.5'
implementation 'javax.ws.rs:jsr311-api:1.1.1'
implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1'
implementation 'org.openapitools:jackson-databind-nullable:0.2.4'
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"

View File

@@ -16,7 +16,7 @@ lazy val root = (project in file(".")).
"org.apache.commons" % "commons-lang3" % "3.12.0",
"javax.ws.rs" % "jsr311-api" % "1.1.1",
"javax.ws.rs" % "javax.ws.rs-api" % "2.1.1",
"org.openapitools" % "jackson-databind-nullable" % "0.2.4",
"org.openapitools" % "jackson-databind-nullable" % "0.2.6",
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.2",
"io.gsonfire" % "gson-fire" % "1.8.5" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",

View File

@@ -258,11 +258,6 @@
</profiles>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-core-version}</version>
</dependency>
<!-- @Nullable annotation -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
@@ -310,6 +305,7 @@
<artifactId>jackson-databind-nullable</artifactId>
<version>${jackson-databind-nullable-version}</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
@@ -345,11 +341,11 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<gson-fire-version>1.8.5</gson-fire-version>
<swagger-core-version>1.6.5</swagger-core-version>
<swagger-annotations-version>1.6.6</swagger-annotations-version>
<okhttp-version>4.10.0</okhttp-version>
<gson-version>2.9.1</gson-version>
<commons-lang3-version>3.12.0</commons-lang3-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>5.9.1</junit-version>
<junit-platform-runner.version>1.9.1</junit-platform-runner.version>

View File

@@ -66,6 +66,15 @@ import org.openapitools.client.auth.OAuthFlow;
public class ApiClient {
private String basePath = "http://petstore.swagger.io/v2";
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
new ServerConfiguration(
"http://petstore.swagger.io/v2",
"No description provided",
new HashMap<String, ServerVariable>()
)
));
protected Integer serverIndex = 0;
protected Map<String, String> serverVariables = null;
private boolean debugging = false;
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
@@ -95,8 +104,8 @@ public class ApiClient {
initHttpClient();
// Setup authentications (key: authentication name, value: authentication).
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("petstore_auth", new OAuth());
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
// Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications);
}
@@ -112,8 +121,8 @@ public class ApiClient {
httpClient = client;
// Setup authentications (key: authentication name, value: authentication).
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("petstore_auth", new OAuth());
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
// Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications);
}
@@ -227,6 +236,34 @@ public class ApiClient {
*/
public ApiClient setBasePath(String basePath) {
this.basePath = basePath;
this.serverIndex = null;
return this;
}
public List<ServerConfiguration> getServers() {
return servers;
}
public ApiClient setServers(List<ServerConfiguration> servers) {
this.servers = servers;
return this;
}
public Integer getServerIndex() {
return serverIndex;
}
public ApiClient setServerIndex(Integer serverIndex) {
this.serverIndex = serverIndex;
return this;
}
public Map<String, String> getServerVariables() {
return serverVariables;
}
public ApiClient setServerVariables(Map<String, String> serverVariables) {
this.serverVariables = serverVariables;
return this;
}
@@ -497,6 +534,18 @@ public class ApiClient {
throw new RuntimeException("No OAuth2 authentication configured!");
}
/**
* Helper method to set credentials for AWSV4 Signature
*
* @param accessKey Access Key
* @param secretKey Secret Key
* @param region Region
* @param service Service to access to
*/
public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) {
throw new RuntimeException("No AWS4 authentication configured!");
}
/**
* Set the User-Agent header's value (by adding to the default header map).
*
@@ -1269,7 +1318,18 @@ public class ApiClient {
if (baseUrl != null) {
url.append(baseUrl).append(path);
} else {
url.append(basePath).append(path);
String baseURL;
if (serverIndex != null) {
if (serverIndex < 0 || serverIndex >= servers.size()) {
throw new ArrayIndexOutOfBoundsException(String.format(
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
));
}
baseURL = servers.get(serverIndex).URL(serverVariables);
} else {
baseURL = basePath;
}
url.append(baseURL).append(path);
}
if (queryParams != null && !queryParams.isEmpty()) {

View File

@@ -99,7 +99,7 @@ public class ApiException extends Exception {
* @param responseBody the response body
*/
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody);
}
/**

View File

@@ -20,8 +20,6 @@ import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import com.google.gson.Gson;
@@ -48,7 +46,6 @@ import org.openapitools.client.JSON;
/**
* A category for a pet
*/
@ApiModel(description = "A category for a pet")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Category {
public static final String SERIALIZED_NAME_ID = "id";
@@ -73,7 +70,6 @@ public class Category {
* @return id
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Long getId() {
return id;
@@ -96,7 +92,6 @@ public class Category {
* @return name
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getName() {
return name;
@@ -241,7 +236,7 @@ public class Category {
public void write(JsonWriter out, Category value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
obj.remove("additionalProperties");
// serialize additonal properties
// serialize additional properties
if (value.getAdditionalProperties() != null) {
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
if (entry.getValue() instanceof String)

View File

@@ -20,8 +20,6 @@ import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import com.google.gson.Gson;
@@ -48,7 +46,6 @@ import org.openapitools.client.JSON;
/**
* Describes the result of uploading an image resource
*/
@ApiModel(description = "Describes the result of uploading an image resource")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ModelApiResponse {
public static final String SERIALIZED_NAME_CODE = "code";
@@ -77,7 +74,6 @@ public class ModelApiResponse {
* @return code
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Integer getCode() {
return code;
@@ -100,7 +96,6 @@ public class ModelApiResponse {
* @return type
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getType() {
return type;
@@ -123,7 +118,6 @@ public class ModelApiResponse {
* @return message
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getMessage() {
return message;
@@ -274,7 +268,7 @@ public class ModelApiResponse {
public void write(JsonWriter out, ModelApiResponse value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
obj.remove("additionalProperties");
// serialize additonal properties
// serialize additional properties
if (value.getAdditionalProperties() != null) {
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
if (entry.getValue() instanceof String)

View File

@@ -20,8 +20,6 @@ import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.time.OffsetDateTime;
@@ -49,7 +47,6 @@ import org.openapitools.client.JSON;
/**
* An order for a pets from the pet store
*/
@ApiModel(description = "An order for a pets from the pet store")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Order {
public static final String SERIALIZED_NAME_ID = "id";
@@ -139,7 +136,6 @@ public class Order {
* @return id
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Long getId() {
return id;
@@ -162,7 +158,6 @@ public class Order {
* @return petId
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Long getPetId() {
return petId;
@@ -185,7 +180,6 @@ public class Order {
* @return quantity
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Integer getQuantity() {
return quantity;
@@ -208,7 +202,6 @@ public class Order {
* @return shipDate
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public OffsetDateTime getShipDate() {
return shipDate;
@@ -231,7 +224,6 @@ public class Order {
* @return status
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Order Status")
public StatusEnum getStatus() {
return status;
@@ -254,7 +246,6 @@ public class Order {
* @return complete
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Boolean getComplete() {
return complete;
@@ -411,7 +402,7 @@ public class Order {
public void write(JsonWriter out, Order value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
obj.remove("additionalProperties");
// serialize additonal properties
// serialize additional properties
if (value.getAdditionalProperties() != null) {
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
if (entry.getValue() instanceof String)

View File

@@ -20,8 +20,6 @@ import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -52,7 +50,6 @@ import org.openapitools.client.JSON;
/**
* A pet for sale in the pet store
*/
@ApiModel(description = "A pet for sale in the pet store")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Pet {
public static final String SERIALIZED_NAME_ID = "id";
@@ -73,7 +70,7 @@ public class Pet {
public static final String SERIALIZED_NAME_TAGS = "tags";
@SerializedName(SERIALIZED_NAME_TAGS)
private List<Tag> tags = null;
private List<Tag> tags = new ArrayList<>();
/**
* pet status in the store
@@ -142,7 +139,6 @@ public class Pet {
* @return id
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Long getId() {
return id;
@@ -165,7 +161,6 @@ public class Pet {
* @return category
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Category getCategory() {
return category;
@@ -188,7 +183,6 @@ public class Pet {
* @return name
**/
@javax.annotation.Nonnull
@ApiModelProperty(example = "doggie", required = true, value = "")
public String getName() {
return name;
@@ -216,7 +210,6 @@ public class Pet {
* @return photoUrls
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
public List<String> getPhotoUrls() {
return photoUrls;
@@ -247,7 +240,6 @@ public class Pet {
* @return tags
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public List<Tag> getTags() {
return tags;
@@ -272,7 +264,6 @@ public class Pet {
**/
@Deprecated
@javax.annotation.Nullable
@ApiModelProperty(value = "pet status in the store")
public StatusEnum getStatus() {
return status;
@@ -465,7 +456,7 @@ public class Pet {
public void write(JsonWriter out, Pet value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
obj.remove("additionalProperties");
// serialize additonal properties
// serialize additional properties
if (value.getAdditionalProperties() != null) {
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
if (entry.getValue() instanceof String)

View File

@@ -20,8 +20,6 @@ import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import com.google.gson.Gson;
@@ -48,7 +46,6 @@ import org.openapitools.client.JSON;
/**
* A tag for a pet
*/
@ApiModel(description = "A tag for a pet")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Tag {
public static final String SERIALIZED_NAME_ID = "id";
@@ -73,7 +70,6 @@ public class Tag {
* @return id
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Long getId() {
return id;
@@ -96,7 +92,6 @@ public class Tag {
* @return name
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getName() {
return name;
@@ -241,7 +236,7 @@ public class Tag {
public void write(JsonWriter out, Tag value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
obj.remove("additionalProperties");
// serialize additonal properties
// serialize additional properties
if (value.getAdditionalProperties() != null) {
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
if (entry.getValue() instanceof String)

View File

@@ -20,8 +20,6 @@ import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import com.google.gson.Gson;
@@ -48,7 +46,6 @@ import org.openapitools.client.JSON;
/**
* A User who is purchasing from the pet store
*/
@ApiModel(description = "A User who is purchasing from the pet store")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class User {
public static final String SERIALIZED_NAME_ID = "id";
@@ -97,7 +94,6 @@ public class User {
* @return id
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Long getId() {
return id;
@@ -120,7 +116,6 @@ public class User {
* @return username
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getUsername() {
return username;
@@ -143,7 +138,6 @@ public class User {
* @return firstName
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getFirstName() {
return firstName;
@@ -166,7 +160,6 @@ public class User {
* @return lastName
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getLastName() {
return lastName;
@@ -189,7 +182,6 @@ public class User {
* @return email
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getEmail() {
return email;
@@ -212,7 +204,6 @@ public class User {
* @return password
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getPassword() {
return password;
@@ -235,7 +226,6 @@ public class User {
* @return phone
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getPhone() {
return phone;
@@ -258,7 +248,6 @@ public class User {
* @return userStatus
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "User Status")
public Integer getUserStatus() {
return userStatus;
@@ -436,7 +425,7 @@ public class User {
public void write(JsonWriter out, User value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
obj.remove("additionalProperties");
// serialize additonal properties
// serialize additional properties
if (value.getAdditionalProperties() != null) {
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
if (entry.getValue() instanceof String)