Include parameter's default value in comment for operations

for Java feign, retrofit and retrofit2 clients
This commit is contained in:
xhh
2016-03-19 16:12:34 +08:00
parent 56122b4a01
commit 794aae3fcf
58 changed files with 1913 additions and 406 deletions

View File

@@ -0,0 +1,12 @@
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

View File

@@ -0,0 +1,52 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
git_user_id="YOUR_GIT_USR_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="YOUR_GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@@ -6,20 +6,23 @@ import io.swagger.client.model.Pet;
import io.swagger.client.model.InlineResponse200;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import feign.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-19T15:53:31.820+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
* @param body Pet object that needs to be added to the store (optional)
* @return void
*/
@RequestLine("POST /pet")
@@ -32,7 +35,7 @@ public interface PetApi extends ApiClient.Api {
/**
* 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
* @param body Pet object in the form of byte array (optional)
* @return void
*/
@RequestLine("POST /pet?testing_byte_array=true")
@@ -45,8 +48,8 @@ public interface PetApi extends ApiClient.Api {
/**
* Deletes a pet
*
* @param petId Pet id to delete
* @param apiKey
* @param petId Pet id to delete (required)
* @param apiKey (optional)
* @return void
*/
@RequestLine("DELETE /pet/{petId}")
@@ -60,7 +63,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
* @param status Status values that need to be considered for query (optional, default to available)
* @return List<Pet>
*/
@RequestLine("GET /pet/findByStatus?status={status}")
@@ -73,7 +76,7 @@ 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
* @param tags Tags to filter by (optional)
* @return List<Pet>
*/
@RequestLine("GET /pet/findByTags?tags={tags}")
@@ -86,7 +89,7 @@ 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
* @param petId ID of pet that needs to be fetched (required)
* @return Pet
*/
@RequestLine("GET /pet/{petId}")
@@ -99,7 +102,7 @@ public interface PetApi extends ApiClient.Api {
/**
* 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
* @param petId ID of pet that needs to be fetched (required)
* @return InlineResponse200
*/
@RequestLine("GET /pet/{petId}?response=inline_arbitrary_object")
@@ -112,7 +115,7 @@ public interface PetApi extends ApiClient.Api {
/**
* 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
* @param petId ID of pet that needs to be fetched (required)
* @return byte[]
*/
@RequestLine("GET /pet/{petId}?testing_byte_array=true")
@@ -125,7 +128,7 @@ public interface PetApi extends ApiClient.Api {
/**
* Update an existing pet
*
* @param body Pet object that needs to be added to the store
* @param body Pet object that needs to be added to the store (optional)
* @return void
*/
@RequestLine("PUT /pet")
@@ -138,9 +141,9 @@ public interface PetApi extends ApiClient.Api {
/**
* Updates a pet in the store with form data
*
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet
* @param status Updated status of the pet
* @param petId ID of pet that needs to be updated (required)
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @return void
*/
@RequestLine("POST /pet/{petId}")
@@ -153,9 +156,9 @@ public interface PetApi extends ApiClient.Api {
/**
* uploads an image
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
* @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
*/
@RequestLine("POST /pet/{petId}/uploadImage")
@@ -165,4 +168,5 @@ public interface PetApi extends ApiClient.Api {
})
void uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file);
}

View File

@@ -4,20 +4,23 @@ import io.swagger.client.ApiClient;
import io.swagger.client.model.Order;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import feign.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-19T15:53:31.820+08:00")
public interface StoreApi extends ApiClient.Api {
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
* @param orderId ID of the order that needs to be deleted (required)
* @return void
*/
@RequestLine("DELETE /store/order/{orderId}")
@@ -30,7 +33,7 @@ public interface StoreApi extends ApiClient.Api {
/**
* 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
* @param status Status value that needs to be considered for query (optional, default to placed)
* @return List<Order>
*/
@RequestLine("GET /store/findByStatus?status={status}")
@@ -67,7 +70,7 @@ public interface StoreApi extends ApiClient.Api {
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @param orderId ID of pet that needs to be fetched (required)
* @return Order
*/
@RequestLine("GET /store/order/{orderId}")
@@ -80,7 +83,7 @@ public interface StoreApi extends ApiClient.Api {
/**
* Place an order for a pet
*
* @param body order placed for purchasing the pet
* @param body order placed for purchasing the pet (optional)
* @return Order
*/
@RequestLine("POST /store/order")
@@ -90,4 +93,5 @@ public interface StoreApi extends ApiClient.Api {
})
Order placeOrder(Order body);
}

View File

@@ -4,20 +4,23 @@ import io.swagger.client.ApiClient;
import io.swagger.client.model.User;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import feign.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-19T15:53:31.820+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
* @param body Created user object (optional)
* @return void
*/
@RequestLine("POST /user")
@@ -30,7 +33,7 @@ public interface UserApi extends ApiClient.Api {
/**
* Creates list of users with given input array
*
* @param body List of user object
* @param body List of user object (optional)
* @return void
*/
@RequestLine("POST /user/createWithArray")
@@ -43,7 +46,7 @@ public interface UserApi extends ApiClient.Api {
/**
* Creates list of users with given input array
*
* @param body List of user object
* @param body List of user object (optional)
* @return void
*/
@RequestLine("POST /user/createWithList")
@@ -56,7 +59,7 @@ public interface UserApi extends ApiClient.Api {
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @param username The name that needs to be deleted (required)
* @return void
*/
@RequestLine("DELETE /user/{username}")
@@ -69,7 +72,7 @@ public interface UserApi extends ApiClient.Api {
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return User
*/
@RequestLine("GET /user/{username}")
@@ -82,8 +85,8 @@ public interface UserApi extends ApiClient.Api {
/**
* Logs user into the system
*
* @param username The user name for login
* @param password The password for login in clear text
* @param username The user name for login (optional)
* @param password The password for login in clear text (optional)
* @return String
*/
@RequestLine("GET /user/login?username={username}&password={password}")
@@ -108,8 +111,8 @@ 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
* @param body Updated user object
* @param username name that need to be deleted (required)
* @param body Updated user object (optional)
* @return void
*/
@RequestLine("PUT /user/{username}")
@@ -119,4 +122,5 @@ public interface UserApi extends ApiClient.Api {
})
void updateUser(@Param("username") String username, User body);
}

View File

@@ -13,12 +13,16 @@ import java.util.List;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-14T22:17:50.356+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-19T15:53:31.820+08:00")
public class InlineResponse200 {
private List<Tag> tags = new ArrayList<Tag>();
private List<String> photoUrls = new ArrayList<String>();
private String name = null;
private Long id = null;
private Object category = null;
private List<Tag> tags = new ArrayList<Tag>();
public enum StatusEnum {
@@ -40,24 +44,39 @@ public class InlineResponse200 {
}
private StatusEnum status = null;
private String name = null;
private List<String> photoUrls = new ArrayList<String>();
/**
**/
public InlineResponse200 tags(List<Tag> tags) {
this.tags = tags;
public InlineResponse200 photoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("tags")
public List<Tag> getTags() {
return tags;
@JsonProperty("photoUrls")
public List<String> getPhotoUrls() {
return photoUrls;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
public void setPhotoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
}
/**
**/
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;
}
@@ -95,6 +114,23 @@ public class InlineResponse200 {
}
/**
**/
public InlineResponse200 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
**/
@@ -113,40 +149,6 @@ public class InlineResponse200 {
}
/**
**/
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 photoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("photoUrls")
public List<String> getPhotoUrls() {
return photoUrls;
}
public void setPhotoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
}
@Override
public boolean equals(java.lang.Object o) {
@@ -157,17 +159,17 @@ public class InlineResponse200 {
return false;
}
InlineResponse200 inlineResponse200 = (InlineResponse200) o;
return Objects.equals(this.tags, inlineResponse200.tags) &&
return Objects.equals(this.photoUrls, inlineResponse200.photoUrls) &&
Objects.equals(this.name, inlineResponse200.name) &&
Objects.equals(this.id, inlineResponse200.id) &&
Objects.equals(this.category, inlineResponse200.category) &&
Objects.equals(this.status, inlineResponse200.status) &&
Objects.equals(this.name, inlineResponse200.name) &&
Objects.equals(this.photoUrls, inlineResponse200.photoUrls);
Objects.equals(this.tags, inlineResponse200.tags) &&
Objects.equals(this.status, inlineResponse200.status);
}
@Override
public int hashCode() {
return Objects.hash(tags, id, category, status, name, photoUrls);
return Objects.hash(photoUrls, name, id, category, tags, status);
}
@Override
@@ -175,12 +177,12 @@ public class InlineResponse200 {
StringBuilder sb = new StringBuilder();
sb.append("class InlineResponse200 {\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\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(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
sb.append("}");
return sb.toString();
}
@@ -197,3 +199,5 @@ public class InlineResponse200 {
}
}

View File

@@ -0,0 +1,78 @@
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-19T15:53:31.820+08:00")
public class Model200Response {
private Integer name = null;
/**
**/
public Model200Response name(Integer name) {
this.name = name;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("name")
public Integer getName() {
return name;
}
public void setName(Integer name) {
this.name = name;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Model200Response _200Response = (Model200Response) o;
return Objects.equals(this.name, _200Response.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Model200Response {\n");
sb.append(" name: ").append(toIndentedString(name)).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

@@ -0,0 +1,78 @@
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-19T15:53:31.820+08:00")
public class ModelReturn {
private Integer _return = null;
/**
**/
public ModelReturn _return(Integer _return) {
this._return = _return;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("return")
public Integer getReturn() {
return _return;
}
public void setReturn(Integer _return) {
this._return = _return;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ModelReturn _return = (ModelReturn) o;
return Objects.equals(this._return, _return._return);
}
@Override
public int hashCode() {
return Objects.hash(_return);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ModelReturn {\n");
sb.append(" _return: ").append(toIndentedString(_return)).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

@@ -0,0 +1,98 @@
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-19T15:53:31.820+08:00")
public class Name {
private Integer name = null;
private Integer snakeCase = null;
/**
**/
public Name name(Integer name) {
this.name = name;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("name")
public Integer getName() {
return name;
}
public void setName(Integer name) {
this.name = name;
}
/**
**/
public Name snakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("snake_case")
public Integer getSnakeCase() {
return snakeCase;
}
public void setSnakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Name name = (Name) o;
return Objects.equals(this.name, name.name) &&
Objects.equals(this.snakeCase, name.snakeCase);
}
@Override
public int hashCode() {
return Objects.hash(name, snakeCase);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Name {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).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

@@ -0,0 +1,78 @@
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-19T15:53:31.820+08:00")
public class SpecialModelName {
private Long specialPropertyName = null;
/**
**/
public SpecialModelName specialPropertyName(Long specialPropertyName) {
this.specialPropertyName = specialPropertyName;
return this;
}
@ApiModelProperty(example = "null", value = "")
@JsonProperty("$special[property.name]")
public Long getSpecialPropertyName() {
return specialPropertyName;
}
public void setSpecialPropertyName(Long specialPropertyName) {
this.specialPropertyName = specialPropertyName;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SpecialModelName specialModelName = (SpecialModelName) o;
return Objects.equals(this.specialPropertyName, specialModelName.specialPropertyName);
}
@Override
public int hashCode() {
return Objects.hash(specialPropertyName);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SpecialModelName {\n");
sb.append(" specialPropertyName: ").append(toIndentedString(specialPropertyName)).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 ");
}
}