Update petstore to use an inline model for testing

and add test cases to Java clients for "object" type with no properties.
This commit is contained in:
xhh
2016-03-03 12:48:44 +08:00
parent 7bea6da587
commit f9cc29fb74
31 changed files with 872 additions and 1243 deletions

View File

@@ -4,7 +4,7 @@ import io.swagger.client.ApiClient;
import io.swagger.client.model.Pet;
import java.io.File;
import io.swagger.client.model.PetWithArbitraryObject;
import io.swagger.client.model.InlineResponse200;
import java.util.ArrayList;
import java.util.HashMap;
@@ -12,7 +12,7 @@ import java.util.List;
import java.util.Map;
import feign.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-02T21:04:56.888+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-03T12:04:41.120+08:00")
public interface PetApi extends ApiClient.Api {
@@ -127,17 +127,17 @@ public interface PetApi extends ApiClient.Api {
void uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file);
/**
* Fake endpoint to test byte array return by 'Find pet by ID'
* Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
* @param petId ID of pet that needs to be fetched
* @return PetWithArbitraryObject
* @return InlineResponse200
*/
@RequestLine("GET /pet/{petId}?response=inline_arbitrary_object")
@Headers({
"Content-type: application/json",
"Accepts: application/json",
})
PetWithArbitraryObject getPetByIdWithObject(@Param("petId") Long petId);
InlineResponse200 getPetByIdInObject(@Param("petId") Long petId);
/**
* Fake endpoint to test byte array return by 'Find pet by ID'

View File

@@ -10,7 +10,7 @@ import java.util.List;
import java.util.Map;
import feign.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-02T21:04:56.888+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-03T12:04:41.120+08:00")
public interface StoreApi extends ApiClient.Api {
@@ -40,7 +40,7 @@ public interface StoreApi extends ApiClient.Api {
Map<String, Integer> getInventory();
/**
* Returns pet inventories by status
* Fake endpoint to test arbitrary object return by &#39;Get inventory&#39;
* Returns an arbitrary object which is actually a map of status codes to quantities
* @return Object
*/

View File

@@ -0,0 +1,114 @@
package io.swagger.client.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-03T12:04:41.120+08:00")
public class InlineResponse200 {
private String name = null;
private Long id = null;
private Object category = null;
/**
**/
public InlineResponse200 name(String name) {
this.name = name;
return this;
}
@ApiModelProperty(example = "doggie", value = "")
@JsonProperty("name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/**
**/
public InlineResponse200 id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(example = "null", required = true, value = "")
@JsonProperty("id")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/**
**/
public InlineResponse200 category(Object category) {
this.category = category;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("category")
public Object getCategory() {
return category;
}
public void setCategory(Object category) {
this.category = category;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
InlineResponse200 inlineResponse200 = (InlineResponse200) o;
return Objects.equals(this.name, inlineResponse200.name) &&
Objects.equals(this.id, inlineResponse200.id) &&
Objects.equals(this.category, inlineResponse200.category);
}
@Override
public int hashCode() {
return Objects.hash(name, id, category);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class InlineResponse200 {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" category: ").append(toIndentedString(category)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -1,199 +0,0 @@
package io.swagger.client.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.Tag;
import java.util.ArrayList;
import java.util.List;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-02T21:04:56.888+08:00")
public class PetWithArbitraryObject {
private Long id = null;
private Object category = null;
private String name = null;
private List<String> photoUrls = new ArrayList<String>();
private List<Tag> tags = new ArrayList<Tag>();
public enum StatusEnum {
AVAILABLE("available"),
PENDING("pending"),
SOLD("sold");
private String value;
StatusEnum(String value) {
this.value = value;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
private StatusEnum status = null;
/**
**/
public PetWithArbitraryObject id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("id")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/**
**/
public PetWithArbitraryObject category(Object category) {
this.category = category;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("category")
public Object getCategory() {
return category;
}
public void setCategory(Object category) {
this.category = category;
}
/**
**/
public PetWithArbitraryObject name(String name) {
this.name = name;
return this;
}
@ApiModelProperty(example = "doggie", required = true, value = "")
@JsonProperty("name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/**
**/
public PetWithArbitraryObject photoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
return this;
}
@ApiModelProperty(example = "null", required = true, value = "")
@JsonProperty("photoUrls")
public List<String> getPhotoUrls() {
return photoUrls;
}
public void setPhotoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
}
/**
**/
public PetWithArbitraryObject tags(List<Tag> tags) {
this.tags = tags;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("tags")
public List<Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
/**
* pet status in the store
**/
public PetWithArbitraryObject status(StatusEnum status) {
this.status = status;
return this;
}
@ApiModelProperty(example = "null", value = "pet status in the store")
@JsonProperty("status")
public StatusEnum getStatus() {
return status;
}
public void setStatus(StatusEnum status) {
this.status = status;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PetWithArbitraryObject petWithArbitraryObject = (PetWithArbitraryObject) o;
return Objects.equals(this.id, petWithArbitraryObject.id) &&
Objects.equals(this.category, petWithArbitraryObject.category) &&
Objects.equals(this.name, petWithArbitraryObject.name) &&
Objects.equals(this.photoUrls, petWithArbitraryObject.photoUrls) &&
Objects.equals(this.tags, petWithArbitraryObject.tags) &&
Objects.equals(this.status, petWithArbitraryObject.status);
}
@Override
public int hashCode() {
return Objects.hash(id, category, name, photoUrls, tags, status);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class PetWithArbitraryObject {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" category: ").append(toIndentedString(category)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}