forked from loafle/openapi-generator-original
Rebuild Java clients of the Petstore sample
This commit is contained in:
parent
44bbe301cb
commit
a284bb7a51
@ -39,7 +39,7 @@ import io.swagger.client.auth.HttpBasicAuth;
|
|||||||
import io.swagger.client.auth.ApiKeyAuth;
|
import io.swagger.client.auth.ApiKeyAuth;
|
||||||
import io.swagger.client.auth.OAuth;
|
import io.swagger.client.auth.OAuth;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-09-11T11:35:58.351+08:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-09-23T12:52:56.012+08:00")
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
private Map<String, Client> hostMap = new HashMap<String, Client>();
|
private Map<String, Client> hostMap = new HashMap<String, Client>();
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
@ -384,8 +384,15 @@ public class ApiClient {
|
|||||||
|
|
||||||
if (contentType.startsWith("application/json")) {
|
if (contentType.startsWith("application/json")) {
|
||||||
return json.deserialize(body, returnType);
|
return json.deserialize(body, returnType);
|
||||||
|
} else if (returnType.getType().equals(String.class)) {
|
||||||
|
// Expecting string, return the raw response body.
|
||||||
|
return (T) body;
|
||||||
} else {
|
} else {
|
||||||
throw new ApiException(500, "can not deserialize Content-Type: " + contentType);
|
throw new ApiException(
|
||||||
|
500,
|
||||||
|
"Content type \"" + contentType + "\" is not supported for type: "
|
||||||
|
+ returnType.getType()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ import io.swagger.client.auth.HttpBasicAuth;
|
|||||||
import io.swagger.client.auth.ApiKeyAuth;
|
import io.swagger.client.auth.ApiKeyAuth;
|
||||||
import io.swagger.client.auth.OAuth;
|
import io.swagger.client.auth.OAuth;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-09-11T11:35:51.678+08:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-09-23T12:52:46.364+08:00")
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
private Map<String, Client> hostMap = new HashMap<String, Client>();
|
private Map<String, Client> hostMap = new HashMap<String, Client>();
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
@ -388,8 +388,15 @@ public class ApiClient {
|
|||||||
|
|
||||||
if (contentType.startsWith("application/json")) {
|
if (contentType.startsWith("application/json")) {
|
||||||
return json.deserialize(body, returnType);
|
return json.deserialize(body, returnType);
|
||||||
|
} else if (returnType.getType().equals(String.class)) {
|
||||||
|
// Expecting string, return the raw response body.
|
||||||
|
return (T) body;
|
||||||
} else {
|
} else {
|
||||||
throw new ApiException(500, "can not deserialize Content-Type: " + contentType);
|
throw new ApiException(
|
||||||
|
500,
|
||||||
|
"Content type \"" + contentType + "\" is not supported for type: "
|
||||||
|
+ returnType.getType()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,7 +435,7 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Invocation.Builder invocationBuilder = target.request(contentType).accept(accept);
|
Invocation.Builder invocationBuilder = target.request().accept(accept);
|
||||||
|
|
||||||
for (String key : headerParams.keySet()) {
|
for (String key : headerParams.keySet()) {
|
||||||
String value = headerParams.get(key);
|
String value = headerParams.get(key);
|
||||||
|
@ -535,9 +535,12 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
if (contentType.startsWith("application/json")) {
|
if (contentType.startsWith("application/json")) {
|
||||||
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;
|
||||||
} else {
|
} else {
|
||||||
throw new ApiException(
|
throw new ApiException(
|
||||||
"Content type \"" + contentType + "\" is not supported",
|
"Content type \"" + contentType + "\" is not supported for type: " + returnType,
|
||||||
response.code(),
|
response.code(),
|
||||||
response.headers().toMultimap(),
|
response.headers().toMultimap(),
|
||||||
respBody);
|
respBody);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user