Merge pull request #2158 from xhh/java-improvements

[Java] Remove unused jackson imports from Java models
This commit is contained in:
wing328 2016-02-18 20:49:21 +08:00
commit eec806b54e
42 changed files with 526 additions and 250 deletions

View File

@ -9,6 +9,7 @@ import io.swagger.models.Swagger;
import io.swagger.models.parameters.FormParameter; import io.swagger.models.parameters.FormParameter;
import io.swagger.models.parameters.Parameter; import io.swagger.models.parameters.Parameter;
import io.swagger.models.properties.*; import io.swagger.models.properties.*;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -531,18 +532,18 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
} }
} }
if(model.isEnum == null || model.isEnum) { if(!BooleanUtils.toBoolean(model.isEnum)) {
// needed by all pojos, but not enums // needed by all pojos, but not enums
model.imports.add("ApiModelProperty"); model.imports.add("ApiModelProperty");
model.imports.add("ApiModel"); model.imports.add("ApiModel");
// comment out below as it's in the model template // comment out below as it's in the model template
//model.imports.add("Objects"); //model.imports.add("Objects");
final String lib = getLibrary(); final String lib = getLibrary();
if(StringUtils.isEmpty(lib) || "feign".equals(lib) || "jersey2".equals(lib)) { if(StringUtils.isEmpty(lib) || "feign".equals(lib) || "jersey2".equals(lib)) {
model.imports.add("JsonProperty"); model.imports.add("JsonProperty");
if(model.hasEnums != null || model.hasEnums == true) { if(BooleanUtils.toBoolean(model.hasEnums)) {
model.imports.add("JsonValue"); model.imports.add("JsonValue");
} }
} }
@ -747,7 +748,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
} }
} }
} }
if(removedChildEnum) { if(removedChildEnum) {
// If we removed an entry from this model's vars, we need to ensure hasMore is updated // If we removed an entry from this model's vars, we need to ensure hasMore is updated
int count = 0, numVars = codegenProperties.size(); int count = 0, numVars = codegenProperties.size();

View File

@ -47,16 +47,17 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
} }
if (o == null || getClass() != o.getClass()) { if (o == null || getClass() != o.getClass()) {
return false; return false;
} }{{#hasVars}}
{{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}} {{classname}} {{classVarName}} = ({{classname}}) o;
return {{#vars}}Objects.equals({{name}}, {{classVarName}}.{{name}}){{#hasMore}} && return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
{{/hasMore}}{{^hasMore}};{{/hasMore}}{{/vars}}{{/hasVars}}{{^hasVars}} {{/hasMore}}{{/vars}}{{#parent}} &&
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
return true;{{/hasVars}} return true;{{/hasVars}}
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}); return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
} }
@Override @Override

View File

@ -38,17 +38,17 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
} }
if (o == null || getClass() != o.getClass()) { if (o == null || getClass() != o.getClass()) {
return false; return false;
} }{{#hasVars}}
{{classname}} {{classVarName}} = ({{classname}}) o; {{classname}} {{classVarName}} = ({{classname}}) o;
return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
return true {{#hasVars}}&& {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} && {{/hasMore}}{{/vars}}{{#parent}} &&
{{/hasMore}}{{/vars}}{{/hasVars}} super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
{{#parent}}&& super.equals(o){{/parent}}; return true;{{/hasVars}}
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}},{{/hasVars}} super.hashCode(){{/parent}}); return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
} }
@Override @Override

View File

@ -20,7 +20,7 @@ mvn deploy
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
After the client libarary is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*:
```xml ```xml
<dependency> <dependency>

View File

@ -1,3 +1,6 @@
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'io.swagger' group = 'io.swagger'
version = '1.0.0' version = '1.0.0'

View File

@ -41,7 +41,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 = "2016-02-12T18:48:10.013-08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class ApiClient { public class ApiClient {
private Map<String, String> defaultHeaderMap = new HashMap<String, String>(); private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private String basePath = "http://petstore.swagger.io/v2"; private String basePath = "http://petstore.swagger.io/v2";
@ -83,8 +83,12 @@ public class ApiClient {
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>(); authentications = new HashMap<String, Authentication>();
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("petstore_auth", new OAuth()); authentications.put("petstore_auth", new OAuth());
authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id"));
authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret"));
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query"));
authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header"));
// Prevent the authentications from being modified. // Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications); authentications = Collections.unmodifiableMap(authentications);
} }

View File

@ -12,7 +12,7 @@ import java.io.File;
import java.util.*; import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class PetApi { public class PetApi {
private ApiClient apiClient; private ApiClient apiClient;
@ -238,7 +238,7 @@ public class PetApi {
}; };
final String contentType = apiClient.selectHeaderContentType(contentTypes); final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "api_key" }; String[] authNames = new String[] { "petstore_auth", "api_key" };
GenericType<Pet> returnType = new GenericType<Pet>() {}; GenericType<Pet> returnType = new GenericType<Pet>() {};
@ -438,7 +438,7 @@ public class PetApi {
}; };
final String contentType = apiClient.selectHeaderContentType(contentTypes); final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "api_key" }; String[] authNames = new String[] { "petstore_auth", "api_key" };
GenericType<byte[]> returnType = new GenericType<byte[]>() {}; GenericType<byte[]> returnType = new GenericType<byte[]>() {};

View File

@ -12,7 +12,7 @@ import io.swagger.client.model.Order;
import java.util.*; import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class StoreApi { public class StoreApi {
private ApiClient apiClient; private ApiClient apiClient;
@ -106,7 +106,7 @@ public class StoreApi {
}; };
final String contentType = apiClient.selectHeaderContentType(contentTypes); final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { }; String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" };
GenericType<Order> returnType = new GenericType<Order>() {}; GenericType<Order> returnType = new GenericType<Order>() {};
@ -153,7 +153,7 @@ public class StoreApi {
}; };
final String contentType = apiClient.selectHeaderContentType(contentTypes); final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { }; String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" };
GenericType<Order> returnType = new GenericType<Order>() {}; GenericType<Order> returnType = new GenericType<Order>() {};

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class Category { public class Category {
private Long id = null; private Long id = null;
@ -63,10 +62,8 @@ public class Category {
return false; return false;
} }
Category category = (Category) o; Category category = (Category) o;
return Objects.equals(this.id, category.id) &&
return true && Objects.equals(id, category.id) && Objects.equals(this.name, category.name);
Objects.equals(name, category.name)
;
} }
@Override @Override

View File

@ -11,7 +11,7 @@ import java.util.Date;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class Order { public class Order {
private Long id = null; private Long id = null;
@ -161,14 +161,12 @@ public class Order {
return false; return false;
} }
Order order = (Order) o; Order order = (Order) o;
return Objects.equals(this.id, order.id) &&
return true && Objects.equals(id, order.id) && Objects.equals(this.petId, order.petId) &&
Objects.equals(petId, order.petId) && Objects.equals(this.quantity, order.quantity) &&
Objects.equals(quantity, order.quantity) && Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(shipDate, order.shipDate) && Objects.equals(this.status, order.status) &&
Objects.equals(status, order.status) && Objects.equals(this.complete, order.complete);
Objects.equals(complete, order.complete)
;
} }
@Override @Override

View File

@ -13,7 +13,7 @@ import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class Pet { public class Pet {
private Long id = null; private Long id = null;
@ -163,14 +163,12 @@ public class Pet {
return false; return false;
} }
Pet pet = (Pet) o; Pet pet = (Pet) o;
return Objects.equals(this.id, pet.id) &&
return true && Objects.equals(id, pet.id) && Objects.equals(this.category, pet.category) &&
Objects.equals(category, pet.category) && Objects.equals(this.name, pet.name) &&
Objects.equals(name, pet.name) && Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(photoUrls, pet.photoUrls) && Objects.equals(this.tags, pet.tags) &&
Objects.equals(tags, pet.tags) && Objects.equals(this.status, pet.status);
Objects.equals(status, pet.status)
;
} }
@Override @Override

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class Tag { public class Tag {
private Long id = null; private Long id = null;
@ -63,10 +62,8 @@ public class Tag {
return false; return false;
} }
Tag tag = (Tag) o; Tag tag = (Tag) o;
return Objects.equals(this.id, tag.id) &&
return true && Objects.equals(id, tag.id) && Objects.equals(this.name, tag.name);
Objects.equals(name, tag.name)
;
} }
@Override @Override

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class User { public class User {
private Long id = null; private Long id = null;
@ -178,16 +177,14 @@ public class User {
return false; return false;
} }
User user = (User) o; User user = (User) o;
return Objects.equals(this.id, user.id) &&
return true && Objects.equals(id, user.id) && Objects.equals(this.username, user.username) &&
Objects.equals(username, user.username) && Objects.equals(this.firstName, user.firstName) &&
Objects.equals(firstName, user.firstName) && Objects.equals(this.lastName, user.lastName) &&
Objects.equals(lastName, user.lastName) && Objects.equals(this.email, user.email) &&
Objects.equals(email, user.email) && Objects.equals(this.password, user.password) &&
Objects.equals(password, user.password) && Objects.equals(this.phone, user.phone) &&
Objects.equals(phone, user.phone) && Objects.equals(this.userStatus, user.userStatus);
Objects.equals(userStatus, user.userStatus)
;
} }
@Override @Override

View File

@ -131,7 +131,13 @@ public class ApiClientTest {
@Test @Test
public void testSetApiKeyAndPrefix() { public void testSetApiKeyAndPrefix() {
ApiKeyAuth auth = (ApiKeyAuth) apiClient.getAuthentications().get("api_key"); ApiKeyAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof ApiKeyAuth) {
auth = (ApiKeyAuth) _auth;
break;
}
}
auth.setApiKey(null); auth.setApiKey(null);
auth.setApiKeyPrefix(null); auth.setApiKeyPrefix(null);

View File

@ -1,3 +1,6 @@
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'io.swagger' group = 'io.swagger'
version = '1.0.0' version = '1.0.0'

View File

@ -18,7 +18,7 @@ import feign.slf4j.Slf4jLogger;
import io.swagger.client.auth.*; import io.swagger.client.auth.*;
import io.swagger.client.auth.OAuth.AccessTokenListener; import io.swagger.client.auth.OAuth.AccessTokenListener;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00")
public class ApiClient { public class ApiClient {
public interface Api {} public interface Api {}
@ -42,8 +42,16 @@ public class ApiClient {
RequestInterceptor auth; RequestInterceptor auth;
if (authName == "petstore_auth") { if (authName == "petstore_auth") {
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
} else if (authName == "test_api_client_id") {
auth = new ApiKeyAuth("header", "x-test_api_client_id");
} else if (authName == "test_api_client_secret") {
auth = new ApiKeyAuth("header", "x-test_api_client_secret");
} else if (authName == "api_key") { } else if (authName == "api_key") {
auth = new ApiKeyAuth("header", "api_key"); auth = new ApiKeyAuth("header", "api_key");
} else if (authName == "test_api_key_query") {
auth = new ApiKeyAuth("query", "test_api_key_query");
} else if (authName == "test_api_key_header") {
auth = new ApiKeyAuth("header", "test_api_key_header");
} else { } else {
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
} }

View File

@ -8,7 +8,7 @@ import java.io.File;
import java.util.*; import java.util.*;
import feign.*; import feign.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00")
public interface PetApi extends ApiClient.Api { public interface PetApi extends ApiClient.Api {
@ -122,4 +122,30 @@ public interface PetApi extends ApiClient.Api {
}) })
void uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); void uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file);
/**
* Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
* @param petId ID of pet that needs to be fetched
* @return byte[]
*/
@RequestLine("GET /pet/{petId}?testing_byte_array=true")
@Headers({
"Content-type: application/json",
"Accepts: application/json",
})
byte[] getPetByIdWithByteArray(@Param("petId") Long petId);
/**
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
*
* @param body Pet object in the form of byte array
* @return void
*/
@RequestLine("POST /pet?testing_byte_array=true")
@Headers({
"Content-type: application/json",
"Accepts: application/json",
})
void addPetUsingByteArray(byte[] body);
} }

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00")
public class Category { public class Category {
private Long id = null; private Long id = null;
@ -19,8 +18,13 @@ public class Category {
/** /**
**/ **/
public Category id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("id") @JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
@ -32,8 +36,13 @@ public class Category {
/** /**
**/ **/
public Category name(String name) {
this.name = name;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("name") @JsonProperty("name")
public String getName() { public String getName() {
return name; return name;
@ -45,7 +54,7 @@ public class Category {
@Override @Override
public boolean equals(Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
return true; return true;
} }
@ -53,10 +62,8 @@ public class Category {
return false; return false;
} }
Category category = (Category) o; Category category = (Category) o;
return Objects.equals(this.id, category.id) &&
return true && Objects.equals(id, category.id) && Objects.equals(this.name, category.name);
Objects.equals(name, category.name)
;
} }
@Override @Override
@ -79,7 +86,7 @@ public class Category {
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private String toIndentedString(Object o) { private String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

View File

@ -11,7 +11,7 @@ import java.util.Date;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00")
public class Order { public class Order {
private Long id = null; private Long id = null;
@ -44,8 +44,13 @@ public class Order {
/** /**
**/ **/
public Order id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("id") @JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
@ -57,8 +62,13 @@ public class Order {
/** /**
**/ **/
public Order petId(Long petId) {
this.petId = petId;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("petId") @JsonProperty("petId")
public Long getPetId() { public Long getPetId() {
return petId; return petId;
@ -70,8 +80,13 @@ public class Order {
/** /**
**/ **/
public Order quantity(Integer quantity) {
this.quantity = quantity;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("quantity") @JsonProperty("quantity")
public Integer getQuantity() { public Integer getQuantity() {
return quantity; return quantity;
@ -83,8 +98,13 @@ public class Order {
/** /**
**/ **/
public Order shipDate(Date shipDate) {
this.shipDate = shipDate;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("shipDate") @JsonProperty("shipDate")
public Date getShipDate() { public Date getShipDate() {
return shipDate; return shipDate;
@ -97,8 +117,13 @@ public class Order {
/** /**
* Order Status * Order Status
**/ **/
public Order status(StatusEnum status) {
this.status = status;
return this;
}
@ApiModelProperty(value = "Order Status") @ApiModelProperty(example = "null", value = "Order Status")
@JsonProperty("status") @JsonProperty("status")
public StatusEnum getStatus() { public StatusEnum getStatus() {
return status; return status;
@ -110,8 +135,13 @@ public class Order {
/** /**
**/ **/
public Order complete(Boolean complete) {
this.complete = complete;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("complete") @JsonProperty("complete")
public Boolean getComplete() { public Boolean getComplete() {
return complete; return complete;
@ -123,7 +153,7 @@ public class Order {
@Override @Override
public boolean equals(Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
return true; return true;
} }
@ -131,14 +161,12 @@ public class Order {
return false; return false;
} }
Order order = (Order) o; Order order = (Order) o;
return Objects.equals(this.id, order.id) &&
return true && Objects.equals(id, order.id) && Objects.equals(this.petId, order.petId) &&
Objects.equals(petId, order.petId) && Objects.equals(this.quantity, order.quantity) &&
Objects.equals(quantity, order.quantity) && Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(shipDate, order.shipDate) && Objects.equals(this.status, order.status) &&
Objects.equals(status, order.status) && Objects.equals(this.complete, order.complete);
Objects.equals(complete, order.complete)
;
} }
@Override @Override
@ -165,7 +193,7 @@ public class Order {
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private String toIndentedString(Object o) { private String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

View File

@ -13,7 +13,7 @@ import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00")
public class Pet { public class Pet {
private Long id = null; private Long id = null;
@ -46,8 +46,13 @@ public class Pet {
/** /**
**/ **/
public Pet id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("id") @JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
@ -59,8 +64,13 @@ public class Pet {
/** /**
**/ **/
public Pet category(Category category) {
this.category = category;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("category") @JsonProperty("category")
public Category getCategory() { public Category getCategory() {
return category; return category;
@ -72,8 +82,13 @@ public class Pet {
/** /**
**/ **/
public Pet name(String name) {
this.name = name;
return this;
}
@ApiModelProperty(required = true, value = "") @ApiModelProperty(example = "doggie", required = true, value = "")
@JsonProperty("name") @JsonProperty("name")
public String getName() { public String getName() {
return name; return name;
@ -85,8 +100,13 @@ public class Pet {
/** /**
**/ **/
public Pet photoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
return this;
}
@ApiModelProperty(required = true, value = "") @ApiModelProperty(example = "null", required = true, value = "")
@JsonProperty("photoUrls") @JsonProperty("photoUrls")
public List<String> getPhotoUrls() { public List<String> getPhotoUrls() {
return photoUrls; return photoUrls;
@ -98,8 +118,13 @@ public class Pet {
/** /**
**/ **/
public Pet tags(List<Tag> tags) {
this.tags = tags;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("tags") @JsonProperty("tags")
public List<Tag> getTags() { public List<Tag> getTags() {
return tags; return tags;
@ -112,8 +137,13 @@ public class Pet {
/** /**
* pet status in the store * pet status in the store
**/ **/
public Pet status(StatusEnum status) {
this.status = status;
return this;
}
@ApiModelProperty(value = "pet status in the store") @ApiModelProperty(example = "null", value = "pet status in the store")
@JsonProperty("status") @JsonProperty("status")
public StatusEnum getStatus() { public StatusEnum getStatus() {
return status; return status;
@ -125,7 +155,7 @@ public class Pet {
@Override @Override
public boolean equals(Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
return true; return true;
} }
@ -133,14 +163,12 @@ public class Pet {
return false; return false;
} }
Pet pet = (Pet) o; Pet pet = (Pet) o;
return Objects.equals(this.id, pet.id) &&
return true && Objects.equals(id, pet.id) && Objects.equals(this.category, pet.category) &&
Objects.equals(category, pet.category) && Objects.equals(this.name, pet.name) &&
Objects.equals(name, pet.name) && Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(photoUrls, pet.photoUrls) && Objects.equals(this.tags, pet.tags) &&
Objects.equals(tags, pet.tags) && Objects.equals(this.status, pet.status);
Objects.equals(status, pet.status)
;
} }
@Override @Override
@ -167,7 +195,7 @@ public class Pet {
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private String toIndentedString(Object o) { private String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00")
public class Tag { public class Tag {
private Long id = null; private Long id = null;
@ -19,8 +18,13 @@ public class Tag {
/** /**
**/ **/
public Tag id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("id") @JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
@ -32,8 +36,13 @@ public class Tag {
/** /**
**/ **/
public Tag name(String name) {
this.name = name;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("name") @JsonProperty("name")
public String getName() { public String getName() {
return name; return name;
@ -45,7 +54,7 @@ public class Tag {
@Override @Override
public boolean equals(Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
return true; return true;
} }
@ -53,10 +62,8 @@ public class Tag {
return false; return false;
} }
Tag tag = (Tag) o; Tag tag = (Tag) o;
return Objects.equals(this.id, tag.id) &&
return true && Objects.equals(id, tag.id) && Objects.equals(this.name, tag.name);
Objects.equals(name, tag.name)
;
} }
@Override @Override
@ -79,7 +86,7 @@ public class Tag {
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private String toIndentedString(Object o) { private String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00")
public class User { public class User {
private Long id = null; private Long id = null;
@ -25,8 +24,13 @@ public class User {
/** /**
**/ **/
public User id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("id") @JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
@ -38,8 +42,13 @@ public class User {
/** /**
**/ **/
public User username(String username) {
this.username = username;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("username") @JsonProperty("username")
public String getUsername() { public String getUsername() {
return username; return username;
@ -51,8 +60,13 @@ public class User {
/** /**
**/ **/
public User firstName(String firstName) {
this.firstName = firstName;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("firstName") @JsonProperty("firstName")
public String getFirstName() { public String getFirstName() {
return firstName; return firstName;
@ -64,8 +78,13 @@ public class User {
/** /**
**/ **/
public User lastName(String lastName) {
this.lastName = lastName;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("lastName") @JsonProperty("lastName")
public String getLastName() { public String getLastName() {
return lastName; return lastName;
@ -77,8 +96,13 @@ public class User {
/** /**
**/ **/
public User email(String email) {
this.email = email;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("email") @JsonProperty("email")
public String getEmail() { public String getEmail() {
return email; return email;
@ -90,8 +114,13 @@ public class User {
/** /**
**/ **/
public User password(String password) {
this.password = password;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("password") @JsonProperty("password")
public String getPassword() { public String getPassword() {
return password; return password;
@ -103,8 +132,13 @@ public class User {
/** /**
**/ **/
public User phone(String phone) {
this.phone = phone;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("phone") @JsonProperty("phone")
public String getPhone() { public String getPhone() {
return phone; return phone;
@ -117,8 +151,13 @@ public class User {
/** /**
* User Status * User Status
**/ **/
public User userStatus(Integer userStatus) {
this.userStatus = userStatus;
return this;
}
@ApiModelProperty(value = "User Status") @ApiModelProperty(example = "null", value = "User Status")
@JsonProperty("userStatus") @JsonProperty("userStatus")
public Integer getUserStatus() { public Integer getUserStatus() {
return userStatus; return userStatus;
@ -130,7 +169,7 @@ public class User {
@Override @Override
public boolean equals(Object o) { public boolean equals(java.lang.Object o) {
if (this == o) { if (this == o) {
return true; return true;
} }
@ -138,16 +177,14 @@ public class User {
return false; return false;
} }
User user = (User) o; User user = (User) o;
return Objects.equals(this.id, user.id) &&
return true && Objects.equals(id, user.id) && Objects.equals(this.username, user.username) &&
Objects.equals(username, user.username) && Objects.equals(this.firstName, user.firstName) &&
Objects.equals(firstName, user.firstName) && Objects.equals(this.lastName, user.lastName) &&
Objects.equals(lastName, user.lastName) && Objects.equals(this.email, user.email) &&
Objects.equals(email, user.email) && Objects.equals(this.password, user.password) &&
Objects.equals(password, user.password) && Objects.equals(this.phone, user.phone) &&
Objects.equals(phone, user.phone) && Objects.equals(this.userStatus, user.userStatus);
Objects.equals(userStatus, user.userStatus)
;
} }
@Override @Override
@ -176,7 +213,7 @@ public class User {
* Convert the given object to string with each line indented by 4 spaces * Convert the given object to string with each line indented by 4 spaces
* (except the first line). * (except the first line).
*/ */
private String toIndentedString(Object o) { private String toIndentedString(java.lang.Object o) {
if (o == null) { if (o == null) {
return "null"; return "null";
} }

View File

@ -1,3 +1,6 @@
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'io.swagger' group = 'io.swagger'
version = '1.0.0' version = '1.0.0'

View File

@ -48,7 +48,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 = "2016-01-28T16:23:25.238+01:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class ApiClient { public class ApiClient {
private Map<String, String> defaultHeaderMap = new HashMap<String, String>(); private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private String basePath = "http://petstore.swagger.io/v2"; private String basePath = "http://petstore.swagger.io/v2";
@ -85,7 +85,11 @@ public class ApiClient {
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>(); authentications = new HashMap<String, Authentication>();
authentications.put("petstore_auth", new OAuth()); authentications.put("petstore_auth", new OAuth());
authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id"));
authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret"));
authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query"));
authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header"));
// Prevent the authentications from being modified. // Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications); authentications = Collections.unmodifiableMap(authentications);
} }

View File

@ -12,7 +12,7 @@ import java.io.File;
import java.util.*; import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class PetApi { public class PetApi {
private ApiClient apiClient; private ApiClient apiClient;
@ -238,7 +238,7 @@ public class PetApi {
}; };
final String contentType = apiClient.selectHeaderContentType(contentTypes); final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "api_key" }; String[] authNames = new String[] { "petstore_auth", "api_key" };
GenericType<Pet> returnType = new GenericType<Pet>() {}; GenericType<Pet> returnType = new GenericType<Pet>() {};
@ -438,7 +438,7 @@ public class PetApi {
}; };
final String contentType = apiClient.selectHeaderContentType(contentTypes); final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "api_key" }; String[] authNames = new String[] { "petstore_auth", "api_key" };
GenericType<byte[]> returnType = new GenericType<byte[]>() {}; GenericType<byte[]> returnType = new GenericType<byte[]>() {};

View File

@ -12,7 +12,7 @@ import io.swagger.client.model.Order;
import java.util.*; import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class StoreApi { public class StoreApi {
private ApiClient apiClient; private ApiClient apiClient;
@ -106,7 +106,7 @@ public class StoreApi {
}; };
final String contentType = apiClient.selectHeaderContentType(contentTypes); final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { }; String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" };
GenericType<Order> returnType = new GenericType<Order>() {}; GenericType<Order> returnType = new GenericType<Order>() {};
@ -153,7 +153,7 @@ public class StoreApi {
}; };
final String contentType = apiClient.selectHeaderContentType(contentTypes); final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { }; String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" };
GenericType<Order> returnType = new GenericType<Order>() {}; GenericType<Order> returnType = new GenericType<Order>() {};

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class Category { public class Category {
private Long id = null; private Long id = null;
@ -19,8 +18,13 @@ public class Category {
/** /**
**/ **/
public Category id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("id") @JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
@ -32,8 +36,13 @@ public class Category {
/** /**
**/ **/
public Category name(String name) {
this.name = name;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("name") @JsonProperty("name")
public String getName() { public String getName() {
return name; return name;
@ -53,10 +62,8 @@ public class Category {
return false; return false;
} }
Category category = (Category) o; Category category = (Category) o;
return Objects.equals(this.id, category.id) &&
return true && Objects.equals(id, category.id) && Objects.equals(this.name, category.name);
Objects.equals(name, category.name)
;
} }
@Override @Override

View File

@ -11,7 +11,7 @@ import java.util.Date;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class Order { public class Order {
private Long id = null; private Long id = null;
@ -44,8 +44,13 @@ public class Order {
/** /**
**/ **/
public Order id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("id") @JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
@ -57,8 +62,13 @@ public class Order {
/** /**
**/ **/
public Order petId(Long petId) {
this.petId = petId;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("petId") @JsonProperty("petId")
public Long getPetId() { public Long getPetId() {
return petId; return petId;
@ -70,8 +80,13 @@ public class Order {
/** /**
**/ **/
public Order quantity(Integer quantity) {
this.quantity = quantity;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("quantity") @JsonProperty("quantity")
public Integer getQuantity() { public Integer getQuantity() {
return quantity; return quantity;
@ -83,8 +98,13 @@ public class Order {
/** /**
**/ **/
public Order shipDate(Date shipDate) {
this.shipDate = shipDate;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("shipDate") @JsonProperty("shipDate")
public Date getShipDate() { public Date getShipDate() {
return shipDate; return shipDate;
@ -97,8 +117,13 @@ public class Order {
/** /**
* Order Status * Order Status
**/ **/
public Order status(StatusEnum status) {
this.status = status;
return this;
}
@ApiModelProperty(value = "Order Status") @ApiModelProperty(example = "null", value = "Order Status")
@JsonProperty("status") @JsonProperty("status")
public StatusEnum getStatus() { public StatusEnum getStatus() {
return status; return status;
@ -110,8 +135,13 @@ public class Order {
/** /**
**/ **/
public Order complete(Boolean complete) {
this.complete = complete;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("complete") @JsonProperty("complete")
public Boolean getComplete() { public Boolean getComplete() {
return complete; return complete;
@ -131,14 +161,12 @@ public class Order {
return false; return false;
} }
Order order = (Order) o; Order order = (Order) o;
return Objects.equals(this.id, order.id) &&
return true && Objects.equals(id, order.id) && Objects.equals(this.petId, order.petId) &&
Objects.equals(petId, order.petId) && Objects.equals(this.quantity, order.quantity) &&
Objects.equals(quantity, order.quantity) && Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(shipDate, order.shipDate) && Objects.equals(this.status, order.status) &&
Objects.equals(status, order.status) && Objects.equals(this.complete, order.complete);
Objects.equals(complete, order.complete)
;
} }
@Override @Override

View File

@ -13,7 +13,7 @@ import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class Pet { public class Pet {
private Long id = null; private Long id = null;
@ -46,8 +46,13 @@ public class Pet {
/** /**
**/ **/
public Pet id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("id") @JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
@ -59,8 +64,13 @@ public class Pet {
/** /**
**/ **/
public Pet category(Category category) {
this.category = category;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("category") @JsonProperty("category")
public Category getCategory() { public Category getCategory() {
return category; return category;
@ -72,8 +82,13 @@ public class Pet {
/** /**
**/ **/
public Pet name(String name) {
this.name = name;
return this;
}
@ApiModelProperty(required = true, value = "") @ApiModelProperty(example = "doggie", required = true, value = "")
@JsonProperty("name") @JsonProperty("name")
public String getName() { public String getName() {
return name; return name;
@ -85,8 +100,13 @@ public class Pet {
/** /**
**/ **/
public Pet photoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
return this;
}
@ApiModelProperty(required = true, value = "") @ApiModelProperty(example = "null", required = true, value = "")
@JsonProperty("photoUrls") @JsonProperty("photoUrls")
public List<String> getPhotoUrls() { public List<String> getPhotoUrls() {
return photoUrls; return photoUrls;
@ -98,8 +118,13 @@ public class Pet {
/** /**
**/ **/
public Pet tags(List<Tag> tags) {
this.tags = tags;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("tags") @JsonProperty("tags")
public List<Tag> getTags() { public List<Tag> getTags() {
return tags; return tags;
@ -112,8 +137,13 @@ public class Pet {
/** /**
* pet status in the store * pet status in the store
**/ **/
public Pet status(StatusEnum status) {
this.status = status;
return this;
}
@ApiModelProperty(value = "pet status in the store") @ApiModelProperty(example = "null", value = "pet status in the store")
@JsonProperty("status") @JsonProperty("status")
public StatusEnum getStatus() { public StatusEnum getStatus() {
return status; return status;
@ -133,14 +163,12 @@ public class Pet {
return false; return false;
} }
Pet pet = (Pet) o; Pet pet = (Pet) o;
return Objects.equals(this.id, pet.id) &&
return true && Objects.equals(id, pet.id) && Objects.equals(this.category, pet.category) &&
Objects.equals(category, pet.category) && Objects.equals(this.name, pet.name) &&
Objects.equals(name, pet.name) && Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(photoUrls, pet.photoUrls) && Objects.equals(this.tags, pet.tags) &&
Objects.equals(tags, pet.tags) && Objects.equals(this.status, pet.status);
Objects.equals(status, pet.status)
;
} }
@Override @Override

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class Tag { public class Tag {
private Long id = null; private Long id = null;
@ -19,8 +18,13 @@ public class Tag {
/** /**
**/ **/
public Tag id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("id") @JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
@ -32,8 +36,13 @@ public class Tag {
/** /**
**/ **/
public Tag name(String name) {
this.name = name;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("name") @JsonProperty("name")
public String getName() { public String getName() {
return name; return name;
@ -53,10 +62,8 @@ public class Tag {
return false; return false;
} }
Tag tag = (Tag) o; Tag tag = (Tag) o;
return Objects.equals(this.id, tag.id) &&
return true && Objects.equals(id, tag.id) && Objects.equals(this.name, tag.name);
Objects.equals(name, tag.name)
;
} }
@Override @Override

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects; import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class User { public class User {
private Long id = null; private Long id = null;
@ -25,8 +24,13 @@ public class User {
/** /**
**/ **/
public User id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("id") @JsonProperty("id")
public Long getId() { public Long getId() {
return id; return id;
@ -38,8 +42,13 @@ public class User {
/** /**
**/ **/
public User username(String username) {
this.username = username;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("username") @JsonProperty("username")
public String getUsername() { public String getUsername() {
return username; return username;
@ -51,8 +60,13 @@ public class User {
/** /**
**/ **/
public User firstName(String firstName) {
this.firstName = firstName;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("firstName") @JsonProperty("firstName")
public String getFirstName() { public String getFirstName() {
return firstName; return firstName;
@ -64,8 +78,13 @@ public class User {
/** /**
**/ **/
public User lastName(String lastName) {
this.lastName = lastName;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("lastName") @JsonProperty("lastName")
public String getLastName() { public String getLastName() {
return lastName; return lastName;
@ -77,8 +96,13 @@ public class User {
/** /**
**/ **/
public User email(String email) {
this.email = email;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("email") @JsonProperty("email")
public String getEmail() { public String getEmail() {
return email; return email;
@ -90,8 +114,13 @@ public class User {
/** /**
**/ **/
public User password(String password) {
this.password = password;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("password") @JsonProperty("password")
public String getPassword() { public String getPassword() {
return password; return password;
@ -103,8 +132,13 @@ public class User {
/** /**
**/ **/
public User phone(String phone) {
this.phone = phone;
return this;
}
@ApiModelProperty(value = "") @ApiModelProperty(example = "null", value = "")
@JsonProperty("phone") @JsonProperty("phone")
public String getPhone() { public String getPhone() {
return phone; return phone;
@ -117,8 +151,13 @@ public class User {
/** /**
* User Status * User Status
**/ **/
public User userStatus(Integer userStatus) {
this.userStatus = userStatus;
return this;
}
@ApiModelProperty(value = "User Status") @ApiModelProperty(example = "null", value = "User Status")
@JsonProperty("userStatus") @JsonProperty("userStatus")
public Integer getUserStatus() { public Integer getUserStatus() {
return userStatus; return userStatus;
@ -138,16 +177,14 @@ public class User {
return false; return false;
} }
User user = (User) o; User user = (User) o;
return Objects.equals(this.id, user.id) &&
return true && Objects.equals(id, user.id) && Objects.equals(this.username, user.username) &&
Objects.equals(username, user.username) && Objects.equals(this.firstName, user.firstName) &&
Objects.equals(firstName, user.firstName) && Objects.equals(this.lastName, user.lastName) &&
Objects.equals(lastName, user.lastName) && Objects.equals(this.email, user.email) &&
Objects.equals(email, user.email) && Objects.equals(this.password, user.password) &&
Objects.equals(password, user.password) && Objects.equals(this.phone, user.phone) &&
Objects.equals(phone, user.phone) && Objects.equals(this.userStatus, user.userStatus);
Objects.equals(userStatus, user.userStatus)
;
} }
@Override @Override

View File

@ -131,7 +131,13 @@ public class ApiClientTest {
@Test @Test
public void testSetApiKeyAndPrefix() { public void testSetApiKeyAndPrefix() {
ApiKeyAuth auth = (ApiKeyAuth) apiClient.getAuthentications().get("api_key"); ApiKeyAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof ApiKeyAuth) {
auth = (ApiKeyAuth) _auth;
break;
}
}
auth.setApiKey(null); auth.setApiKey(null);
auth.setApiKeyPrefix(null); auth.setApiKeyPrefix(null);

View File

@ -20,7 +20,7 @@ mvn deploy
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
After the client libarary is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*:
```xml ```xml
<dependency> <dependency>

View File

@ -145,8 +145,12 @@ public class ApiClient {
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>(); authentications = new HashMap<String, Authentication>();
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("petstore_auth", new OAuth()); authentications.put("petstore_auth", new OAuth());
authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id"));
authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret"));
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query"));
authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header"));
// Prevent the authentications from being modified. // Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications); authentications = Collections.unmodifiableMap(authentications);
} }

View File

@ -491,7 +491,7 @@ public class PetApi {
}); });
} }
String[] authNames = new String[] { "api_key" }; String[] authNames = new String[] { "petstore_auth", "api_key" };
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener); return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
} }
@ -936,7 +936,7 @@ public class PetApi {
}); });
} }
String[] authNames = new String[] { "api_key" }; String[] authNames = new String[] { "petstore_auth", "api_key" };
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener); return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
} }

View File

@ -180,7 +180,7 @@ public class StoreApi {
}); });
} }
String[] authNames = new String[] { }; String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" };
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener); return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
} }
@ -288,7 +288,7 @@ public class StoreApi {
}); });
} }
String[] authNames = new String[] { }; String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" };
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener); return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
} }

View File

@ -52,8 +52,8 @@ public class Category {
return false; return false;
} }
Category category = (Category) o; Category category = (Category) o;
return Objects.equals(id, category.id) && return Objects.equals(this.id, category.id) &&
Objects.equals(name, category.name); Objects.equals(this.name, category.name);
} }
@Override @Override

View File

@ -133,12 +133,12 @@ public enum StatusEnum {
return false; return false;
} }
Order order = (Order) o; Order order = (Order) o;
return Objects.equals(id, order.id) && return Objects.equals(this.id, order.id) &&
Objects.equals(petId, order.petId) && Objects.equals(this.petId, order.petId) &&
Objects.equals(quantity, order.quantity) && Objects.equals(this.quantity, order.quantity) &&
Objects.equals(shipDate, order.shipDate) && Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(status, order.status) && Objects.equals(this.status, order.status) &&
Objects.equals(complete, order.complete); Objects.equals(this.complete, order.complete);
} }
@Override @Override

View File

@ -135,12 +135,12 @@ public enum StatusEnum {
return false; return false;
} }
Pet pet = (Pet) o; Pet pet = (Pet) o;
return Objects.equals(id, pet.id) && return Objects.equals(this.id, pet.id) &&
Objects.equals(category, pet.category) && Objects.equals(this.category, pet.category) &&
Objects.equals(name, pet.name) && Objects.equals(this.name, pet.name) &&
Objects.equals(photoUrls, pet.photoUrls) && Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(tags, pet.tags) && Objects.equals(this.tags, pet.tags) &&
Objects.equals(status, pet.status); Objects.equals(this.status, pet.status);
} }
@Override @Override

View File

@ -52,8 +52,8 @@ public class Tag {
return false; return false;
} }
Tag tag = (Tag) o; Tag tag = (Tag) o;
return Objects.equals(id, tag.id) && return Objects.equals(this.id, tag.id) &&
Objects.equals(name, tag.name); Objects.equals(this.name, tag.name);
} }
@Override @Override

View File

@ -137,14 +137,14 @@ public class User {
return false; return false;
} }
User user = (User) o; User user = (User) o;
return Objects.equals(id, user.id) && return Objects.equals(this.id, user.id) &&
Objects.equals(username, user.username) && Objects.equals(this.username, user.username) &&
Objects.equals(firstName, user.firstName) && Objects.equals(this.firstName, user.firstName) &&
Objects.equals(lastName, user.lastName) && Objects.equals(this.lastName, user.lastName) &&
Objects.equals(email, user.email) && Objects.equals(this.email, user.email) &&
Objects.equals(password, user.password) && Objects.equals(this.password, user.password) &&
Objects.equals(phone, user.phone) && Objects.equals(this.phone, user.phone) &&
Objects.equals(userStatus, user.userStatus); Objects.equals(this.userStatus, user.userStatus);
} }
@Override @Override

View File

@ -170,7 +170,13 @@ public class ApiClientTest {
@Test @Test
public void testSetApiKeyAndPrefix() { public void testSetApiKeyAndPrefix() {
ApiKeyAuth auth = (ApiKeyAuth) apiClient.getAuthentications().get("api_key"); ApiKeyAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof ApiKeyAuth) {
auth = (ApiKeyAuth) _auth;
break;
}
}
auth.setApiKey(null); auth.setApiKey(null);
auth.setApiKeyPrefix(null); auth.setApiKeyPrefix(null);