mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 19:33:55 +00:00
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.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 {
|
||||
private Map<String, Client> hostMap = new HashMap<String, Client>();
|
||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||
@ -384,8 +384,15 @@ public class ApiClient {
|
||||
|
||||
if (contentType.startsWith("application/json")) {
|
||||
return json.deserialize(body, returnType);
|
||||
} else if (returnType.getType().equals(String.class)) {
|
||||
// Expecting string, return the raw response body.
|
||||
return (T) body;
|
||||
} 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.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 {
|
||||
private Map<String, Client> hostMap = new HashMap<String, Client>();
|
||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||
@ -388,8 +388,15 @@ public class ApiClient {
|
||||
|
||||
if (contentType.startsWith("application/json")) {
|
||||
return json.deserialize(body, returnType);
|
||||
} else if (returnType.getType().equals(String.class)) {
|
||||
// Expecting string, return the raw response body.
|
||||
return (T) body;
|
||||
} 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()) {
|
||||
String value = headerParams.get(key);
|
||||
|
@ -535,9 +535,12 @@ public class ApiClient {
|
||||
}
|
||||
if (contentType.startsWith("application/json")) {
|
||||
return json.deserialize(respBody, returnType);
|
||||
} else if (returnType.equals(String.class)) {
|
||||
// Expecting string, return the raw response body.
|
||||
return (T) respBody;
|
||||
} else {
|
||||
throw new ApiException(
|
||||
"Content type \"" + contentType + "\" is not supported",
|
||||
"Content type \"" + contentType + "\" is not supported for type: " + returnType,
|
||||
response.code(),
|
||||
response.headers().toMultimap(),
|
||||
respBody);
|
||||
|
Loading…
Reference in New Issue
Block a user