Revert "Revert "[Java] Add auto-generated documentation in Markdown to Java clients""

This commit is contained in:
wing328
2016-04-22 10:13:54 +08:00
parent 8d88cd3709
commit fb04bb7d4d
191 changed files with 6103 additions and 2856 deletions

View File

@@ -14,7 +14,7 @@ import feign.codec.EncodeException;
import feign.codec.Encoder;
import feign.RequestTemplate;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class FormAwareEncoder implements Encoder {
public static final String UTF_8 = "utf-8";
private static final String LINE_FEED = "\r\n";

View File

@@ -1,6 +1,6 @@
package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).

View File

@@ -3,7 +3,7 @@ package io.swagger.client.api;
import io.swagger.client.ApiClient;
import io.swagger.client.model.Pet;
import io.swagger.client.model.InlineResponse200;
import io.swagger.client.model.ModelApiResponse;
import java.io.File;
import java.util.ArrayList;
@@ -12,14 +12,14 @@ import java.util.List;
import java.util.Map;
import feign.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-21T18:26:32.462+08:00")
public interface PetApi extends ApiClient.Api {
/**
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store (optional)
* @param body Pet object that needs to be added to the store (required)
* @return void
*/
@RequestLine("POST /pet")
@@ -29,19 +29,6 @@ public interface PetApi extends ApiClient.Api {
})
void addPet(Pet body);
/**
* 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 (optional)
* @return void
*/
@RequestLine("POST /pet?testing_byte_array=true")
@Headers({
"Content-type: application/json",
"Accepts: application/json",
})
void addPetUsingByteArray(byte[] body);
/**
* Deletes a pet
*
@@ -60,7 +47,7 @@ public interface PetApi extends ApiClient.Api {
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for query (optional, default to available)
* @param status Status values that need to be considered for filter (required)
* @return List<Pet>
*/
@RequestLine("GET /pet/findByStatus?status={status}")
@@ -72,8 +59,8 @@ public interface PetApi extends ApiClient.Api {
/**
* Finds Pets by tags
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (optional)
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (required)
* @return List<Pet>
*/
@RequestLine("GET /pet/findByTags?tags={tags}")
@@ -85,8 +72,8 @@ public interface PetApi extends ApiClient.Api {
/**
* Find pet by ID
* 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 (required)
* Returns a single pet
* @param petId ID of pet to return (required)
* @return Pet
*/
@RequestLine("GET /pet/{petId}")
@@ -96,36 +83,10 @@ public interface PetApi extends ApiClient.Api {
})
Pet getPetById(@Param("petId") Long petId);
/**
* Fake endpoint to test inline arbitrary object 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 (required)
* @return InlineResponse200
*/
@RequestLine("GET /pet/{petId}?response=inline_arbitrary_object")
@Headers({
"Content-type: application/json",
"Accepts: application/json",
})
InlineResponse200 getPetByIdInObject(@Param("petId") Long petId);
/**
* 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 (required)
* @return byte[]
*/
@RequestLine("GET /pet/{petId}?testing_byte_array=true")
@Headers({
"Content-type: application/json",
"Accepts: application/json",
})
byte[] petPetIdtestingByteArraytrueGet(@Param("petId") Long petId);
/**
* Update an existing pet
*
* @param body Pet object that needs to be added to the store (optional)
* @param body Pet object that needs to be added to the store (required)
* @return void
*/
@RequestLine("PUT /pet")
@@ -148,7 +109,7 @@ public interface PetApi extends ApiClient.Api {
"Content-type: application/x-www-form-urlencoded",
"Accepts: application/json",
})
void updatePetWithForm(@Param("petId") String petId, @Param("name") String name, @Param("status") String status);
void updatePetWithForm(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status);
/**
* uploads an image
@@ -156,12 +117,12 @@ public interface PetApi extends ApiClient.Api {
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return void
* @return ModelApiResponse
*/
@RequestLine("POST /pet/{petId}/uploadImage")
@Headers({
"Content-type: multipart/form-data",
"Accepts: application/json",
})
void uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file);
ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file);
}

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-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public interface StoreApi extends ApiClient.Api {
@@ -27,19 +27,6 @@ public interface StoreApi extends ApiClient.Api {
})
void deleteOrder(@Param("orderId") String orderId);
/**
* Finds orders by status
* A single status value can be provided as a string
* @param status Status value that needs to be considered for query (optional, default to placed)
* @return List<Order>
*/
@RequestLine("GET /store/findByStatus?status={status}")
@Headers({
"Content-type: application/json",
"Accepts: application/json",
})
List<Order> findOrdersByStatus(@Param("status") String status);
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@@ -52,18 +39,6 @@ public interface StoreApi extends ApiClient.Api {
})
Map<String, Integer> getInventory();
/**
* 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
*/
@RequestLine("GET /store/inventory?response=arbitrary_object")
@Headers({
"Content-type: application/json",
"Accepts: application/json",
})
Object getInventoryInObject();
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@@ -75,12 +50,12 @@ public interface StoreApi extends ApiClient.Api {
"Content-type: application/json",
"Accepts: application/json",
})
Order getOrderById(@Param("orderId") String orderId);
Order getOrderById(@Param("orderId") Long orderId);
/**
* Place an order for a pet
*
* @param body order placed for purchasing the pet (optional)
* @param body order placed for purchasing the pet (required)
* @return Order
*/
@RequestLine("POST /store/order")

View File

@@ -10,14 +10,14 @@ import java.util.List;
import java.util.Map;
import feign.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public interface UserApi extends ApiClient.Api {
/**
* Create user
* This can only be done by the logged in user.
* @param body Created user object (optional)
* @param body Created user object (required)
* @return void
*/
@RequestLine("POST /user")
@@ -30,7 +30,7 @@ public interface UserApi extends ApiClient.Api {
/**
* Creates list of users with given input array
*
* @param body List of user object (optional)
* @param body List of user object (required)
* @return void
*/
@RequestLine("POST /user/createWithArray")
@@ -43,7 +43,7 @@ public interface UserApi extends ApiClient.Api {
/**
* Creates list of users with given input array
*
* @param body List of user object (optional)
* @param body List of user object (required)
* @return void
*/
@RequestLine("POST /user/createWithList")
@@ -82,8 +82,8 @@ public interface UserApi extends ApiClient.Api {
/**
* Logs user into the system
*
* @param username The user name for login (optional)
* @param password The password for login in clear text (optional)
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @return String
*/
@RequestLine("GET /user/login?username={username}&password={password}")
@@ -109,7 +109,7 @@ public interface UserApi extends ApiClient.Api {
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted (required)
* @param body Updated user object (optional)
* @param body Updated user object (required)
* @return void
*/
@RequestLine("PUT /user/{username}")

View File

@@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class Animal {
private String className = null;

View File

@@ -10,7 +10,7 @@ import io.swagger.client.model.Animal;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class Cat extends Animal {
private String className = null;

View File

@@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class Category {
private Long id = null;

View File

@@ -10,7 +10,7 @@ import io.swagger.client.model.Animal;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class Dog extends Animal {
private String className = null;

View File

@@ -11,7 +11,7 @@ import java.util.Date;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class FormatTest {
private Integer integer = null;

View File

@@ -12,7 +12,7 @@ import io.swagger.annotations.ApiModelProperty;
**/
@ApiModel(description = "Model for testing model name starting with number")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class Model200Response {
private Integer name = null;

View File

@@ -0,0 +1,113 @@
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-04-21T18:26:32.462+08:00")
public class ModelApiResponse {
private Integer code = null;
private String type = null;
private String message = null;
/**
**/
public ModelApiResponse code(Integer code) {
this.code = code;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("code")
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
/**
**/
public ModelApiResponse type(String type) {
this.type = type;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("type")
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
/**
**/
public ModelApiResponse message(String message) {
this.message = message;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("message")
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ModelApiResponse _apiResponse = (ModelApiResponse) o;
return Objects.equals(this.code, _apiResponse.code) &&
Objects.equals(this.type, _apiResponse.type) &&
Objects.equals(this.message, _apiResponse.message);
}
@Override
public int hashCode() {
return Objects.hash(code, type, message);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ModelApiResponse {\n");
sb.append(" code: ").append(toIndentedString(code)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" message: ").append(toIndentedString(message)).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

@@ -12,7 +12,7 @@ import io.swagger.annotations.ApiModelProperty;
**/
@ApiModel(description = "Model for testing reserved words")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class ModelReturn {
private Integer _return = null;

View File

@@ -12,7 +12,7 @@ import io.swagger.annotations.ApiModelProperty;
**/
@ApiModel(description = "Model for testing model name same as property name")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class Name {
private Integer name = null;

View File

@@ -11,7 +11,7 @@ import java.util.Date;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class Order {
private Long id = null;
@@ -39,14 +39,24 @@ public class Order {
}
private StatusEnum status = null;
private Boolean complete = null;
private Boolean complete = false;
/**
**/
public Order 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;
}
/**

View File

@@ -14,7 +14,7 @@ import java.util.List;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class Pet {
private Long id = null;

View File

@@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class SpecialModelName {
private Long specialPropertyName = null;

View File

@@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class Tag {
private Long id = null;

View File

@@ -9,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-13T14:36:33.302+02:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-19T19:29:57.731+08:00")
public class User {
private Long id = null;

View File

@@ -120,7 +120,7 @@ public class PetApiTest {
Pet fetched = api.getPetById(pet.getId());
api.updatePetWithForm(fetched.getId().toString(), "furt", null);
api.updatePetWithForm(fetched.getId(), "furt", null);
Pet updated = api.getPetById(fetched.getId());
assertEquals(updated.getName(), "furt");

View File

@@ -35,7 +35,7 @@ public class StoreApiTest {
Order order = createOrder();
api.placeOrder(order);
Order fetched = api.getOrderById(order.getId().toString());
Order fetched = api.getOrderById(order.getId());
assertEquals(order.getId(), fetched.getId());
assertEquals(order.getPetId(), fetched.getPetId());
assertEquals(order.getQuantity(), fetched.getQuantity());
@@ -46,13 +46,13 @@ public class StoreApiTest {
Order order = createOrder();
api.placeOrder(order);
Order fetched = api.getOrderById(order.getId().toString());
Order fetched = api.getOrderById(order.getId());
assertEquals(fetched.getId(), order.getId());
api.deleteOrder(order.getId().toString());
try {
api.getOrderById(order.getId().toString());
api.getOrderById(order.getId());
fail("expected an error");
} catch (FeignException e) {
assertTrue(e.getMessage().startsWith("status 404 "));