Merge remote-tracking branch 'origin/master' into 6.3.x

This commit is contained in:
William Cheng
2022-11-01 17:42:59 +08:00
1972 changed files with 36976 additions and 6630 deletions

View File

@@ -13,7 +13,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.3.0'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0'
}
}
@@ -65,7 +65,7 @@ if(hasProperty('target') && target == 'android') {
task.from variant.javaCompile.destinationDir
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
artifacts.add('archives', task);
artifacts.add('archives', task)
}
}
@@ -106,21 +106,21 @@ ext {
}
dependencies {
implementation 'io.swagger:swagger-annotations:1.6.5'
implementation 'io.swagger:swagger-annotations:1.6.8'
implementation "com.google.code.findbugs:jsr305:3.0.2"
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0'
implementation 'com.google.code.gson:gson:2.9.1'
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.3'
implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1'
implementation 'org.openapitools:jackson-databind-nullable:0.2.4'
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"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1'
testImplementation 'org.mockito:mockito-core:3.12.4'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1'
}
javadoc {

View File

@@ -10,19 +10,20 @@ lazy val root = (project in file(".")).
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.6.5",
"com.squareup.okhttp3" % "okhttp" % "4.9.3",
"com.squareup.okhttp3" % "logging-interceptor" % "4.9.3",
"com.google.code.gson" % "gson" % "2.9.0",
"com.squareup.okhttp3" % "okhttp" % "4.10.0",
"com.squareup.okhttp3" % "logging-interceptor" % "4.10.0",
"com.google.code.gson" % "gson" % "2.9.1",
"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.3",
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1",
"org.openapitools" % "jackson-databind-nullable" % "0.2.4",
"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",
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile",
"jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile",
"org.junit.jupiter" % "junit-jupiter-api" % "5.8.2" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
"org.junit.jupiter" % "junit-jupiter-api" % "5.9.1" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test",
"org.mockito" % "mockito-core" % "3.12.4" % "test"
)
)

View File

@@ -50,7 +50,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>
<executions>
<execution>
<id>enforce-maven</id>
@@ -93,6 +93,7 @@
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
@@ -109,7 +110,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<executions>
<execution>
<goals>
@@ -123,7 +124,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<executions>
<execution>
<id>add_sources</id>
@@ -154,7 +155,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<version>3.4.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
@@ -177,7 +178,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
@@ -291,7 +292,7 @@
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
@@ -345,17 +346,17 @@
<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>
<okhttp-version>4.9.3</okhttp-version>
<gson-version>2.9.0</gson-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.3</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>5.8.2</junit-version>
<junit-platform-runner.version>1.6.2</junit-platform-runner.version>
<junit-version>5.9.1</junit-version>
<junit-platform-runner.version>1.9.1</junit-platform-runner.version>
<mockito-core-version>3.12.4</mockito-core-version>
<javax.ws.rs-api-version>2.1.1</javax.ws.rs-api-version>
<jsr311-api-version>1.1.1</jsr311-api-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spotless.version>2.21.0</spotless.version>
<spotless.version>2.27.2</spotless.version>
</properties>
</project>

View File

@@ -354,7 +354,7 @@ public class ApiClient {
* @return a {@link org.openapitools.client.ApiClient} object
*/
public ApiClient setDateFormat(DateFormat dateFormat) {
this.json.setDateFormat(dateFormat);
JSON.setDateFormat(dateFormat);
return this;
}
@@ -365,7 +365,7 @@ public class ApiClient {
* @return a {@link org.openapitools.client.ApiClient} object
*/
public ApiClient setSqlDateFormat(DateFormat dateFormat) {
this.json.setSqlDateFormat(dateFormat);
JSON.setSqlDateFormat(dateFormat);
return this;
}
@@ -376,7 +376,7 @@ public class ApiClient {
* @return a {@link org.openapitools.client.ApiClient} object
*/
public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
this.json.setOffsetDateTimeFormat(dateFormat);
JSON.setOffsetDateTimeFormat(dateFormat);
return this;
}
@@ -387,7 +387,7 @@ public class ApiClient {
* @return a {@link org.openapitools.client.ApiClient} object
*/
public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
this.json.setLocalDateFormat(dateFormat);
JSON.setLocalDateFormat(dateFormat);
return this;
}
@@ -398,7 +398,7 @@ public class ApiClient {
* @return a {@link org.openapitools.client.ApiClient} object
*/
public ApiClient setLenientOnJson(boolean lenientOnJson) {
this.json.setLenientOnJson(lenientOnJson);
JSON.setLenientOnJson(lenientOnJson);
return this;
}
@@ -679,7 +679,7 @@ public class ApiClient {
return "";
} else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) {
//Serialize to json string and remove the " enclosing characters
String jsonStr = json.serialize(param);
String jsonStr = JSON.serialize(param);
return jsonStr.substring(1, jsonStr.length() - 1);
} else if (param instanceof Collection) {
StringBuilder b = new StringBuilder();
@@ -687,7 +687,7 @@ public class ApiClient {
if (b.length() > 0) {
b.append(",");
}
b.append(String.valueOf(o));
b.append(o);
}
return b.toString();
} else {
@@ -938,7 +938,7 @@ public class ApiClient {
contentType = "application/json";
}
if (isJsonMime(contentType)) {
return json.deserialize(respBody, returnType);
return JSON.deserialize(respBody, returnType);
} else if (returnType.equals(String.class)) {
// Expecting string, return the raw response body.
return (T) respBody;
@@ -972,13 +972,13 @@ public class ApiClient {
} else if (isJsonMime(contentType)) {
String content;
if (obj != null) {
content = json.serialize(obj);
content = JSON.serialize(obj);
} else {
content = null;
}
return RequestBody.create(content, MediaType.parse(contentType));
} else if (obj instanceof String) {
return RequestBody.create(MediaType.parse(contentType), (String) obj);
return RequestBody.create((String) obj, MediaType.parse(contentType));
} else {
throw new ApiException("Content type \"" + contentType + "\" is not supported");
}
@@ -1451,7 +1451,7 @@ public class ApiClient {
} else {
String content;
if (obj != null) {
content = json.serialize(obj);
content = JSON.serialize(obj);
} else {
content = null;
}
@@ -1529,7 +1529,7 @@ public class ApiClient {
KeyStore caKeyStore = newEmptyKeyStore(password);
int index = 0;
for (Certificate certificate : certificates) {
String certificateAlias = "ca" + Integer.toString(index++);
String certificateAlias = "ca" + (index++);
caKeyStore.setCertificateEntry(certificateAlias, certificate);
}
trustManagerFactory.init(caKeyStore);

View File

@@ -42,7 +42,7 @@ public class ServerConfiguration {
throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + ".");
}
}
url = url.replaceAll("\\{" + name + "\\}", value);
url = url.replace("{" + name + "}", value);
}
return url;
}

View File

@@ -101,7 +101,8 @@ public class PetApi {
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/xml", "application/json"
"application/xml",
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
@@ -109,7 +110,8 @@ public class PetApi {
}
final String[] localVarContentTypes = {
"application/json", "application/xml"
"application/json",
"application/xml"
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
@@ -122,15 +124,12 @@ public class PetApi {
@SuppressWarnings("rawtypes")
private okhttp3.Call addPetValidateBeforeCall(Pet pet, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'pet' is set
if (pet == null) {
throw new ApiException("Missing the required parameter 'pet' when calling addPet(Async)");
}
okhttp3.Call localVarCall = addPetCall(pet, _callback);
return localVarCall;
return addPetCall(pet, _callback);
}
@@ -253,7 +252,7 @@ public class PetApi {
// create path and map variables
String localVarPath = "/pet/{petId}"
.replaceAll("\\{" + "petId" + "\\}", localVarApiClient.escapeString(petId.toString()));
.replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
@@ -266,7 +265,6 @@ public class PetApi {
}
final String[] localVarAccepts = {
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
@@ -274,7 +272,6 @@ public class PetApi {
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
@@ -287,15 +284,12 @@ public class PetApi {
@SuppressWarnings("rawtypes")
private okhttp3.Call deletePetValidateBeforeCall(Long petId, String apiKey, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException("Missing the required parameter 'petId' when calling deletePet(Async)");
}
okhttp3.Call localVarCall = deletePetCall(petId, apiKey, _callback);
return localVarCall;
return deletePetCall(petId, apiKey, _callback);
}
@@ -432,7 +426,8 @@ public class PetApi {
}
final String[] localVarAccepts = {
"application/xml", "application/json"
"application/xml",
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
@@ -440,7 +435,6 @@ public class PetApi {
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
@@ -453,15 +447,12 @@ public class PetApi {
@SuppressWarnings("rawtypes")
private okhttp3.Call findPetsByStatusValidateBeforeCall(List<String> status, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'status' is set
if (status == null) {
throw new ApiException("Missing the required parameter 'status' when calling findPetsByStatus(Async)");
}
okhttp3.Call localVarCall = findPetsByStatusCall(status, _callback);
return localVarCall;
return findPetsByStatusCall(status, _callback);
}
@@ -596,7 +587,8 @@ public class PetApi {
}
final String[] localVarAccepts = {
"application/xml", "application/json"
"application/xml",
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
@@ -604,7 +596,6 @@ public class PetApi {
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
@@ -618,15 +609,12 @@ public class PetApi {
@Deprecated
@SuppressWarnings("rawtypes")
private okhttp3.Call findPetsByTagsValidateBeforeCall(List<String> tags, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'tags' is set
if (tags == null) {
throw new ApiException("Missing the required parameter 'tags' when calling findPetsByTags(Async)");
}
okhttp3.Call localVarCall = findPetsByTagsCall(tags, _callback);
return localVarCall;
return findPetsByTagsCall(tags, _callback);
}
@@ -759,7 +747,7 @@ public class PetApi {
// create path and map variables
String localVarPath = "/pet/{petId}"
.replaceAll("\\{" + "petId" + "\\}", localVarApiClient.escapeString(petId.toString()));
.replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
@@ -768,7 +756,8 @@ public class PetApi {
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/xml", "application/json"
"application/xml",
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
@@ -776,7 +765,6 @@ public class PetApi {
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
@@ -789,15 +777,12 @@ public class PetApi {
@SuppressWarnings("rawtypes")
private okhttp3.Call getPetByIdValidateBeforeCall(Long petId, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException("Missing the required parameter 'petId' when calling getPetById(Async)");
}
okhttp3.Call localVarCall = getPetByIdCall(petId, _callback);
return localVarCall;
return getPetByIdCall(petId, _callback);
}
@@ -933,7 +918,8 @@ public class PetApi {
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/xml", "application/json"
"application/xml",
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
@@ -941,7 +927,8 @@ public class PetApi {
}
final String[] localVarContentTypes = {
"application/json", "application/xml"
"application/json",
"application/xml"
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
@@ -954,15 +941,12 @@ public class PetApi {
@SuppressWarnings("rawtypes")
private okhttp3.Call updatePetValidateBeforeCall(Pet pet, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'pet' is set
if (pet == null) {
throw new ApiException("Missing the required parameter 'pet' when calling updatePet(Async)");
}
okhttp3.Call localVarCall = updatePetCall(pet, _callback);
return localVarCall;
return updatePetCall(pet, _callback);
}
@@ -1109,7 +1093,7 @@ public class PetApi {
// create path and map variables
String localVarPath = "/pet/{petId}"
.replaceAll("\\{" + "petId" + "\\}", localVarApiClient.escapeString(petId.toString()));
.replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
@@ -1126,7 +1110,6 @@ public class PetApi {
}
final String[] localVarAccepts = {
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
@@ -1147,15 +1130,12 @@ public class PetApi {
@SuppressWarnings("rawtypes")
private okhttp3.Call updatePetWithFormValidateBeforeCall(Long petId, String name, String status, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException("Missing the required parameter 'petId' when calling updatePetWithForm(Async)");
}
okhttp3.Call localVarCall = updatePetWithFormCall(petId, name, status, _callback);
return localVarCall;
return updatePetWithFormCall(petId, name, status, _callback);
}
@@ -1234,7 +1214,7 @@ public class PetApi {
// create path and map variables
String localVarPath = "/pet/{petId}/uploadImage"
.replaceAll("\\{" + "petId" + "\\}", localVarApiClient.escapeString(petId.toString()));
.replace("{" + "petId" + "}", localVarApiClient.escapeString(petId.toString()));
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
@@ -1272,15 +1252,12 @@ public class PetApi {
@SuppressWarnings("rawtypes")
private okhttp3.Call uploadFileValidateBeforeCall(Long petId, String additionalMetadata, File _file, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'petId' is set
if (petId == null) {
throw new ApiException("Missing the required parameter 'petId' when calling uploadFile(Async)");
}
okhttp3.Call localVarCall = uploadFileCall(petId, additionalMetadata, _file, _callback);
return localVarCall;
return uploadFileCall(petId, additionalMetadata, _file, _callback);
}

View File

@@ -55,6 +55,7 @@ public class OAuthOkHttpClient implements HttpClient {
response.body().string(),
response.body().contentType().toString(),
response.code(),
response.headers().toMultimap(),
responseClass);
} catch (IOException e) {
throw new OAuthSystemException(e);

View File

@@ -65,8 +65,8 @@ public class RetryingOAuth extends OAuth implements Interceptor {
.setClientSecret(clientSecret));
setFlow(flow);
if (parameters != null) {
for (String paramName : parameters.keySet()) {
tokenRequestBuilder.setParameter(paramName, parameters.get(paramName));
for (Map.Entry<String, String> entry : parameters.entrySet()) {
tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue());
}
}
}
@@ -129,8 +129,8 @@ public class RetryingOAuth extends OAuth implements Interceptor {
}
Map<String, String> headers = oAuthRequest.getHeaders();
for (String headerName : headers.keySet()) {
requestBuilder.addHeader(headerName, headers.get(headerName));
for (Map.Entry<String, String> entry : headers.entrySet()) {
requestBuilder.addHeader(entry.getKey(), entry.getValue());
}
requestBuilder.url(oAuthRequest.getLocationUri());

View File

@@ -38,6 +38,7 @@ import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -116,6 +117,10 @@ public class Category {
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
*
* @param key name of the property
* @param value value of the property
* @return the Category instance itself
*/
public Category putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
@@ -127,6 +132,8 @@ public class Category {
/**
* Return the additional (undeclared) property.
*
* @return a map of objects
*/
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
@@ -134,6 +141,9 @@ public class Category {
/**
* Return the additional (undeclared) property with the specified name.
*
* @param key name of the property
* @return an object
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
@@ -267,8 +277,10 @@ public class Category {
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
else
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
} else { // non-primitive type
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
} else if (entry.getValue().isJsonArray()) {
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
} else { // JSON object
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
}
}
}

View File

@@ -38,6 +38,7 @@ import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -143,6 +144,10 @@ public class ModelApiResponse {
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
*
* @param key name of the property
* @param value value of the property
* @return the ModelApiResponse instance itself
*/
public ModelApiResponse putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
@@ -154,6 +159,8 @@ public class ModelApiResponse {
/**
* Return the additional (undeclared) property.
*
* @return a map of objects
*/
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
@@ -161,6 +168,9 @@ public class ModelApiResponse {
/**
* Return the additional (undeclared) property with the specified name.
*
* @param key name of the property
* @return an object
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
@@ -300,8 +310,10 @@ public class ModelApiResponse {
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
else
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
} else { // non-primitive type
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
} else if (entry.getValue().isJsonArray()) {
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
} else { // JSON object
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
}
}
}

View File

@@ -39,6 +39,7 @@ import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -274,6 +275,10 @@ public class Order {
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
*
* @param key name of the property
* @param value value of the property
* @return the Order instance itself
*/
public Order putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
@@ -285,6 +290,8 @@ public class Order {
/**
* Return the additional (undeclared) property.
*
* @return a map of objects
*/
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
@@ -292,6 +299,9 @@ public class Order {
/**
* Return the additional (undeclared) property with the specified name.
*
* @param key name of the property
* @return an object
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
@@ -437,8 +447,10 @@ public class Order {
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
else
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
} else { // non-primitive type
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
} else if (entry.getValue().isJsonArray()) {
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
} else { // JSON object
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
}
}
}

View File

@@ -42,6 +42,7 @@ import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -292,6 +293,10 @@ public class Pet {
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
*
* @param key name of the property
* @param value value of the property
* @return the Pet instance itself
*/
public Pet putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
@@ -303,6 +308,8 @@ public class Pet {
/**
* Return the additional (undeclared) property.
*
* @return a map of objects
*/
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
@@ -310,6 +317,9 @@ public class Pet {
/**
* Return the additional (undeclared) property with the specified name.
*
* @param key name of the property
* @return an object
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
@@ -414,8 +424,10 @@ public class Pet {
if (!jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
// ensure the json data is an array
if ((jsonObj.get("photoUrls") != null && !jsonObj.get("photoUrls").isJsonNull()) && !jsonObj.get("photoUrls").isJsonArray()) {
// ensure the required json array is present
if (jsonObj.get("photoUrls") == null) {
throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`");
} else if (!jsonObj.get("photoUrls").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString()));
}
if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) {
@@ -489,8 +501,10 @@ public class Pet {
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
else
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
} else { // non-primitive type
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
} else if (entry.getValue().isJsonArray()) {
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
} else { // JSON object
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
}
}
}

View File

@@ -38,6 +38,7 @@ import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -116,6 +117,10 @@ public class Tag {
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
*
* @param key name of the property
* @param value value of the property
* @return the Tag instance itself
*/
public Tag putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
@@ -127,6 +132,8 @@ public class Tag {
/**
* Return the additional (undeclared) property.
*
* @return a map of objects
*/
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
@@ -134,6 +141,9 @@ public class Tag {
/**
* Return the additional (undeclared) property with the specified name.
*
* @param key name of the property
* @return an object
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
@@ -267,8 +277,10 @@ public class Tag {
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
else
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
} else { // non-primitive type
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
} else if (entry.getValue().isJsonArray()) {
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
} else { // JSON object
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
}
}
}

View File

@@ -38,6 +38,7 @@ import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -278,6 +279,10 @@ public class User {
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
*
* @param key name of the property
* @param value value of the property
* @return the User instance itself
*/
public User putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
@@ -289,6 +294,8 @@ public class User {
/**
* Return the additional (undeclared) property.
*
* @return a map of objects
*/
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
@@ -296,6 +303,9 @@ public class User {
/**
* Return the additional (undeclared) property with the specified name.
*
* @param key name of the property
* @return an object
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
@@ -462,8 +472,10 @@ public class User {
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
else
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
} else { // non-primitive type
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
} else if (entry.getValue().isJsonArray()) {
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
} else { // JSON object
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
}
}
}