forked from loafle/openapi-generator-original
Rebuild Java Petstore client
This commit is contained in:
parent
fff8972a77
commit
85d0e08a80
@ -109,13 +109,13 @@ public class ApiInvoker {
|
|||||||
|
|
||||||
public static String selectHeaderAccept(String[] accepts) {
|
public static String selectHeaderAccept(String[] accepts) {
|
||||||
if (accepts.length == 0) return "application/json";
|
if (accepts.length == 0) return "application/json";
|
||||||
if (Arrays.asList(accepts).contains("application/json")) return "application/json";
|
if (StringUtil.containsIgnoreCase(accepts, "application/json")) return "application/json";
|
||||||
return joinString(accepts, ",");
|
return StringUtil.join(accepts, ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String selectHeaderContentType(String[] contentTypes) {
|
public static String selectHeaderContentType(String[] contentTypes) {
|
||||||
if (contentTypes.length == 0) return "application/json";
|
if (contentTypes.length == 0) return "application/json";
|
||||||
if (Arrays.asList(contentTypes).contains("application/json")) return "application/json";
|
if (StringUtil.containsIgnoreCase(contentTypes, "application/json")) return "application/json";
|
||||||
return contentTypes[0];
|
return contentTypes[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package io.swagger.client;
|
||||||
|
|
||||||
|
public class StringUtil {
|
||||||
|
public static boolean containsIgnoreCase(String[] array, String value) {
|
||||||
|
for (String str : array) {
|
||||||
|
if (value == null && str == null) return true;
|
||||||
|
if (value != null && value.equalsIgnoreCase(str)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String join(String[] array, String separator) {
|
||||||
|
int len = array.length;
|
||||||
|
if (len == 0) return "";
|
||||||
|
|
||||||
|
StringBuilder out = new StringBuilder();
|
||||||
|
out.append(array[0]);
|
||||||
|
for (int i = 1; i < len; i++) {
|
||||||
|
out.append(separator).append(array[i]);
|
||||||
|
}
|
||||||
|
return out.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -1,64 +0,0 @@
|
|||||||
package io.swagger.client.model;
|
|
||||||
|
|
||||||
|
|
||||||
import com.wordnik.swagger.annotations.*;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
|
|
||||||
|
|
||||||
@ApiModel(description = "")
|
|
||||||
public class ApiResponse {
|
|
||||||
|
|
||||||
private Integer code = null;
|
|
||||||
private String type = null;
|
|
||||||
private String message = null;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
**/
|
|
||||||
@ApiModelProperty(required = false, value = "")
|
|
||||||
@JsonProperty("code")
|
|
||||||
public Integer getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
public void setCode(Integer code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
**/
|
|
||||||
@ApiModelProperty(required = false, value = "")
|
|
||||||
@JsonProperty("type")
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
**/
|
|
||||||
@ApiModelProperty(required = false, value = "")
|
|
||||||
@JsonProperty("message")
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("class ApiResponse {\n");
|
|
||||||
|
|
||||||
sb.append(" code: ").append(code).append("\n");
|
|
||||||
sb.append(" type: ").append(type).append("\n");
|
|
||||||
sb.append(" message: ").append(message).append("\n");
|
|
||||||
sb.append("}\n");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user