mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 19:08:52 +00:00
fix issue 2512: crash w/ NPE when dereferencing networkStatus which could be nil on a volley timeout error
This commit is contained in:
parent
c624311cab
commit
fb705cb9fa
@ -121,7 +121,10 @@ public class {{classname}} {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
|
@ -110,7 +110,7 @@
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger-annotations-version}</version>
|
||||
<version>${swagger-core-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
@ -145,7 +145,7 @@
|
||||
</repository>
|
||||
</repositories>
|
||||
<properties>
|
||||
<swagger-annotations-version>1.5.4</swagger-annotations-version>
|
||||
<swagger-core-version>1.5.8</swagger-core-version>
|
||||
<gson-version>2.3.1</gson-version>
|
||||
<junit-version>4.8.1</junit-version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
|
@ -35,10 +35,22 @@ public class JsonUtil {
|
||||
public static Type getListTypeForDeserialization(Class cls) {
|
||||
String className = cls.getSimpleName();
|
||||
|
||||
if ("Animal".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Animal>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Cat".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Cat>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Category".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Category>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Dog".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Dog>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("InlineResponse200".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<InlineResponse200>>(){}.getType();
|
||||
}
|
||||
@ -81,10 +93,22 @@ public class JsonUtil {
|
||||
public static Type getTypeForDeserialization(Class cls) {
|
||||
String className = cls.getSimpleName();
|
||||
|
||||
if ("Animal".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Animal>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Cat".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Cat>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Category".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Category>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Dog".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Dog>(){}.getType();
|
||||
}
|
||||
|
||||
if ("InlineResponse200".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<InlineResponse200>(){}.getType();
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ public class UserApi {
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
* @return User
|
||||
*/
|
||||
public User getUserByName (String username) throws ApiException {
|
||||
|
@ -0,0 +1,36 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Animal {
|
||||
|
||||
@SerializedName("className")
|
||||
private String className = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Animal {\n");
|
||||
|
||||
sb.append(" className: ").append(className).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Cat extends Animal {
|
||||
|
||||
@SerializedName("className")
|
||||
private String className = null;
|
||||
@SerializedName("declawed")
|
||||
private Boolean declawed = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Boolean getDeclawed() {
|
||||
return declawed;
|
||||
}
|
||||
public void setDeclawed(Boolean declawed) {
|
||||
this.declawed = declawed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Cat {\n");
|
||||
sb.append(" " + super.toString()).append("\n");
|
||||
sb.append(" className: ").append(className).append("\n");
|
||||
sb.append(" declawed: ").append(declawed).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Dog extends Animal {
|
||||
|
||||
@SerializedName("className")
|
||||
private String className = null;
|
||||
@SerializedName("breed")
|
||||
private String breed = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getBreed() {
|
||||
return breed;
|
||||
}
|
||||
public void setBreed(String breed) {
|
||||
this.breed = breed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Dog {\n");
|
||||
sb.append(" " + super.toString()).append("\n");
|
||||
sb.append(" className: ").append(className).append("\n");
|
||||
sb.append(" breed: ").append(breed).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -10,31 +10,42 @@ import com.google.gson.annotations.SerializedName;
|
||||
@ApiModel(description = "")
|
||||
public class InlineResponse200 {
|
||||
|
||||
@SerializedName("tags")
|
||||
private List<Tag> tags = null;
|
||||
@SerializedName("photoUrls")
|
||||
private List<String> photoUrls = null;
|
||||
@SerializedName("name")
|
||||
private String name = null;
|
||||
@SerializedName("id")
|
||||
private Long id = null;
|
||||
@SerializedName("category")
|
||||
private Object category = null;
|
||||
@SerializedName("tags")
|
||||
private List<Tag> tags = null;
|
||||
public enum StatusEnum {
|
||||
available, pending, sold,
|
||||
};
|
||||
@SerializedName("status")
|
||||
private StatusEnum status = null;
|
||||
@SerializedName("name")
|
||||
private String name = null;
|
||||
@SerializedName("photoUrls")
|
||||
private List<String> photoUrls = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@ -60,6 +71,17 @@ public class InlineResponse200 {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
**/
|
||||
@ -72,40 +94,18 @@ public class InlineResponse200 {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class InlineResponse200 {\n");
|
||||
|
||||
sb.append(" tags: ").append(tags).append("\n");
|
||||
sb.append(" photoUrls: ").append(photoUrls).append("\n");
|
||||
sb.append(" name: ").append(name).append("\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" category: ").append(category).append("\n");
|
||||
sb.append(" tags: ").append(tags).append("\n");
|
||||
sb.append(" status: ").append(status).append("\n");
|
||||
sb.append(" name: ").append(name).append("\n");
|
||||
sb.append(" photoUrls: ").append(photoUrls).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -5,7 +5,10 @@ import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
/**
|
||||
* Model for testing model name starting with number
|
||||
**/
|
||||
@ApiModel(description = "Model for testing model name starting with number")
|
||||
public class Model200Response {
|
||||
|
||||
@SerializedName("name")
|
||||
|
@ -5,7 +5,10 @@ import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
/**
|
||||
* Model for testing reserved words
|
||||
**/
|
||||
@ApiModel(description = "Model for testing reserved words")
|
||||
public class ModelReturn {
|
||||
|
||||
@SerializedName("return")
|
||||
|
@ -5,7 +5,10 @@ import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
/**
|
||||
* Model for testing model name same as property name
|
||||
**/
|
||||
@ApiModel(description = "Model for testing model name same as property name")
|
||||
public class Name {
|
||||
|
||||
@SerializedName("name")
|
||||
|
@ -6,7 +6,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.5.0'
|
||||
classpath 'com.android.tools.build:gradle:1.5.+'
|
||||
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
|
||||
|
||||
@ -55,9 +55,10 @@ android {
|
||||
ext {
|
||||
swagger_annotations_version = "1.5.0"
|
||||
gson_version = "2.3.1"
|
||||
httpclient_version = "4.3.3"
|
||||
httpclient_version = "4.5.2"
|
||||
httpcore_version = "4.4.4"
|
||||
volley_version = "1.0.19"
|
||||
junit_version = "4.8.1"
|
||||
junit_version = "4.12"
|
||||
robolectric_version = "3.0"
|
||||
concurrent_unit_version = "0.4.2"
|
||||
}
|
||||
|
@ -191,7 +191,20 @@ public class ApiInvoker {
|
||||
INSTANCE.authentications = new HashMap<String, Authentication>();
|
||||
|
||||
|
||||
INSTANCE.authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header"));
|
||||
|
||||
|
||||
// TODO: comment out below as OAuth does not exist
|
||||
//INSTANCE.authentications.put("petstore_auth", new OAuth());
|
||||
|
||||
|
||||
|
||||
INSTANCE.authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
INSTANCE.authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret"));
|
||||
|
||||
|
||||
|
||||
@ -209,28 +222,15 @@ public class ApiInvoker {
|
||||
|
||||
|
||||
|
||||
INSTANCE.authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
INSTANCE.authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
INSTANCE.authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
INSTANCE.authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header"));
|
||||
|
||||
|
||||
// TODO: comment out below as OAuth does not exist
|
||||
//INSTANCE.authentications.put("petstore_auth", new OAuth());
|
||||
|
||||
|
||||
// Prevent the authentications from being modified.
|
||||
|
@ -35,10 +35,22 @@ public class JsonUtil {
|
||||
public static Type getListTypeForDeserialization(Class cls) {
|
||||
String className = cls.getSimpleName();
|
||||
|
||||
if ("Animal".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Animal>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Cat".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Cat>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Category".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Category>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Dog".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<Dog>>(){}.getType();
|
||||
}
|
||||
|
||||
if ("InlineResponse200".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<List<InlineResponse200>>(){}.getType();
|
||||
}
|
||||
@ -81,10 +93,22 @@ public class JsonUtil {
|
||||
public static Type getTypeForDeserialization(Class cls) {
|
||||
String className = cls.getSimpleName();
|
||||
|
||||
if ("Animal".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Animal>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Cat".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Cat>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Category".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Category>(){}.getType();
|
||||
}
|
||||
|
||||
if ("Dog".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<Dog>(){}.getType();
|
||||
}
|
||||
|
||||
if ("InlineResponse200".equalsIgnoreCase(className)) {
|
||||
return new TypeToken<InlineResponse200>(){}.getType();
|
||||
}
|
||||
|
@ -102,7 +102,10 @@ public class PetApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -231,7 +234,10 @@ public class PetApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -369,7 +375,10 @@ public class PetApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -508,7 +517,10 @@ public class PetApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -646,7 +658,10 @@ public class PetApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -773,7 +788,7 @@ public class PetApi {
|
||||
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "api_key", "petstore_auth" };
|
||||
String[] authNames = new String[] { "petstore_auth", "api_key" };
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
|
||||
@ -788,7 +803,10 @@ public class PetApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -843,7 +861,7 @@ public class PetApi {
|
||||
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "api_key", "petstore_auth" };
|
||||
String[] authNames = new String[] { "petstore_auth", "api_key" };
|
||||
|
||||
try {
|
||||
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
|
||||
@ -919,7 +937,7 @@ public class PetApi {
|
||||
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "api_key", "petstore_auth" };
|
||||
String[] authNames = new String[] { "petstore_auth", "api_key" };
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
|
||||
@ -934,7 +952,10 @@ public class PetApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -989,7 +1010,7 @@ public class PetApi {
|
||||
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "api_key", "petstore_auth" };
|
||||
String[] authNames = new String[] { "petstore_auth", "api_key" };
|
||||
|
||||
try {
|
||||
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
|
||||
@ -1065,7 +1086,7 @@ public class PetApi {
|
||||
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "api_key", "petstore_auth" };
|
||||
String[] authNames = new String[] { "petstore_auth", "api_key" };
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
|
||||
@ -1080,7 +1101,10 @@ public class PetApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -1135,7 +1159,7 @@ public class PetApi {
|
||||
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "api_key", "petstore_auth" };
|
||||
String[] authNames = new String[] { "petstore_auth", "api_key" };
|
||||
|
||||
try {
|
||||
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
|
||||
@ -1220,7 +1244,10 @@ public class PetApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -1367,7 +1394,10 @@ public class PetApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -1530,7 +1560,10 @@ public class PetApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
|
@ -107,7 +107,10 @@ public class StoreApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -244,7 +247,10 @@ public class StoreApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -379,7 +385,10 @@ public class StoreApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -512,7 +521,10 @@ public class StoreApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -637,7 +649,7 @@ public class StoreApi {
|
||||
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "test_api_key_header", "test_api_key_query" };
|
||||
String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" };
|
||||
|
||||
try {
|
||||
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
|
||||
@ -652,7 +664,10 @@ public class StoreApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -707,7 +722,7 @@ public class StoreApi {
|
||||
|
||||
}
|
||||
|
||||
String[] authNames = new String[] { "test_api_key_header", "test_api_key_query" };
|
||||
String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" };
|
||||
|
||||
try {
|
||||
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
|
||||
@ -792,7 +807,10 @@ public class StoreApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
|
@ -101,7 +101,10 @@ public class UserApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -230,7 +233,10 @@ public class UserApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -359,7 +365,10 @@ public class UserApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -494,7 +503,10 @@ public class UserApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -576,7 +588,7 @@ public class UserApi {
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
* @return User
|
||||
*/
|
||||
public User getUserByName (String username) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
|
||||
@ -635,7 +647,10 @@ public class UserApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -646,7 +661,7 @@ public class UserApi {
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
*/
|
||||
public void getUserByName (String username, final Response.Listener<User> responseListener, final Response.ErrorListener errorListener) {
|
||||
Object postBody = null;
|
||||
@ -780,7 +795,10 @@ public class UserApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -917,7 +935,10 @@ public class UserApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
@ -1053,7 +1074,10 @@ public class UserApi {
|
||||
throw ex;
|
||||
} catch (ExecutionException ex) {
|
||||
if(ex.getCause() instanceof VolleyError) {
|
||||
throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
|
||||
VolleyError volleyError = (VolleyError)ex.getCause();
|
||||
if (volleyError.networkResponse != null) {
|
||||
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
} catch (TimeoutException ex) {
|
||||
|
@ -0,0 +1,36 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Animal {
|
||||
|
||||
@SerializedName("className")
|
||||
private String className = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Animal {\n");
|
||||
|
||||
sb.append(" className: ").append(className).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Cat extends Animal {
|
||||
|
||||
@SerializedName("className")
|
||||
private String className = null;
|
||||
@SerializedName("declawed")
|
||||
private Boolean declawed = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Boolean getDeclawed() {
|
||||
return declawed;
|
||||
}
|
||||
public void setDeclawed(Boolean declawed) {
|
||||
this.declawed = declawed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Cat {\n");
|
||||
sb.append(" " + super.toString()).append("\n");
|
||||
sb.append(" className: ").append(className).append("\n");
|
||||
sb.append(" declawed: ").append(declawed).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
public class Dog extends Animal {
|
||||
|
||||
@SerializedName("className")
|
||||
private String className = null;
|
||||
@SerializedName("breed")
|
||||
private String breed = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getBreed() {
|
||||
return breed;
|
||||
}
|
||||
public void setBreed(String breed) {
|
||||
this.breed = breed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Dog {\n");
|
||||
sb.append(" " + super.toString()).append("\n");
|
||||
sb.append(" className: ").append(className).append("\n");
|
||||
sb.append(" breed: ").append(breed).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -10,31 +10,42 @@ import com.google.gson.annotations.SerializedName;
|
||||
@ApiModel(description = "")
|
||||
public class InlineResponse200 {
|
||||
|
||||
@SerializedName("tags")
|
||||
private List<Tag> tags = null;
|
||||
@SerializedName("photoUrls")
|
||||
private List<String> photoUrls = null;
|
||||
@SerializedName("name")
|
||||
private String name = null;
|
||||
@SerializedName("id")
|
||||
private Long id = null;
|
||||
@SerializedName("category")
|
||||
private Object category = null;
|
||||
@SerializedName("tags")
|
||||
private List<Tag> tags = null;
|
||||
public enum StatusEnum {
|
||||
available, pending, sold,
|
||||
};
|
||||
@SerializedName("status")
|
||||
private StatusEnum status = null;
|
||||
@SerializedName("name")
|
||||
private String name = null;
|
||||
@SerializedName("photoUrls")
|
||||
private List<String> photoUrls = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@ -60,6 +71,17 @@ public class InlineResponse200 {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
**/
|
||||
@ -72,40 +94,18 @@ public class InlineResponse200 {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class InlineResponse200 {\n");
|
||||
|
||||
sb.append(" tags: ").append(tags).append("\n");
|
||||
sb.append(" photoUrls: ").append(photoUrls).append("\n");
|
||||
sb.append(" name: ").append(name).append("\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" category: ").append(category).append("\n");
|
||||
sb.append(" tags: ").append(tags).append("\n");
|
||||
sb.append(" status: ").append(status).append("\n");
|
||||
sb.append(" name: ").append(name).append("\n");
|
||||
sb.append(" photoUrls: ").append(photoUrls).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -5,7 +5,10 @@ import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
/**
|
||||
* Model for testing model name starting with number
|
||||
**/
|
||||
@ApiModel(description = "Model for testing model name starting with number")
|
||||
public class Model200Response {
|
||||
|
||||
@SerializedName("name")
|
||||
|
@ -5,7 +5,10 @@ import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
/**
|
||||
* Model for testing reserved words
|
||||
**/
|
||||
@ApiModel(description = "Model for testing reserved words")
|
||||
public class ModelReturn {
|
||||
|
||||
@SerializedName("return")
|
||||
|
@ -5,7 +5,10 @@ import io.swagger.annotations.*;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
|
||||
@ApiModel(description = "")
|
||||
/**
|
||||
* Model for testing model name same as property name
|
||||
**/
|
||||
@ApiModel(description = "Model for testing model name same as property name")
|
||||
public class Name {
|
||||
|
||||
@SerializedName("name")
|
||||
|
Loading…
Reference in New Issue
Block a user