From dfc05f4bbaab32f3ec82ad704f11234af13d1f0e Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 5 Jul 2016 17:49:50 +0800 Subject: [PATCH 1/4] fix doc warning in java retrofit2 client --- .../libraries/retrofit2/ApiClient.mustache | 4 +- .../Java/libraries/retrofit2/pom.mustache | 2 + .../petstore/java/retrofit2/docs/ArrayTest.md | 7 --- .../petstore/java/retrofit2/docs/FakeApi.md | 44 ----------------- .../client/petstore/java/retrofit2/pom.xml | 2 + .../java/io/swagger/client/ApiClient.java | 10 ++-- .../java/io/swagger/client/api/FakeApi.java | 15 +----- .../java/io/swagger/client/api/PetApi.java | 2 +- .../io/swagger/client/model/ArrayTest.java | 49 +------------------ 9 files changed, 15 insertions(+), 120 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache index 9afdc5488b5..6ca343943cf 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache @@ -188,7 +188,7 @@ public class ApiClient { /** * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return + * @return Token request builder */ public TokenRequestBuilder getTokenEndPoint() { for(Interceptor apiAuthorization : apiAuthorizations.values()) { @@ -202,7 +202,7 @@ public class ApiClient { /** * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return + * @return Authentication request builder */ public AuthenticationRequestBuilder getAuthorizationEndPoint() { for(Interceptor apiAuthorization : apiAuthorizations.values()) { diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache index a3e28ff4595..717cca80fd2 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/pom.mustache @@ -68,6 +68,7 @@ org.codehaus.mojo build-helper-maven-plugin + 1.10 add_sources @@ -152,6 +153,7 @@ + UTF-8 {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} ${java.version} ${java.version} diff --git a/samples/client/petstore/java/retrofit2/docs/ArrayTest.md b/samples/client/petstore/java/retrofit2/docs/ArrayTest.md index 2cd4b9d33f9..9feee16427f 100644 --- a/samples/client/petstore/java/retrofit2/docs/ArrayTest.md +++ b/samples/client/petstore/java/retrofit2/docs/ArrayTest.md @@ -7,13 +7,6 @@ Name | Type | Description | Notes **arrayOfString** | **List<String>** | | [optional] **arrayArrayOfInteger** | [**List<List<Long>>**](List.md) | | [optional] **arrayArrayOfModel** | [**List<List<ReadOnlyFirst>>**](List.md) | | [optional] -**arrayOfEnum** | [**List<ArrayOfEnumEnum>**](#List<ArrayOfEnumEnum>) | | [optional] - - - -## Enum: List<ArrayOfEnumEnum> -Name | Value ----- | ----- diff --git a/samples/client/petstore/java/retrofit2/docs/FakeApi.md b/samples/client/petstore/java/retrofit2/docs/FakeApi.md index 0e646d63479..decba432a56 100644 --- a/samples/client/petstore/java/retrofit2/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2/docs/FakeApi.md @@ -4,54 +4,10 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**testCodeInjectEnd**](FakeApi.md#testCodeInjectEnd) | **PUT** fake | To test code injection =end [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumQueryParameters**](FakeApi.md#testEnumQueryParameters) | **GET** fake | To test enum query parameters - -# **testCodeInjectEnd** -> Void testCodeInjectEnd(testCodeInjectEnd) - -To test code injection =end - -### Example -```java -// Import classes: -//import io.swagger.client.ApiException; -//import io.swagger.client.api.FakeApi; - - -FakeApi apiInstance = new FakeApi(); -String testCodeInjectEnd = "testCodeInjectEnd_example"; // String | To test code injection =end -try { - Void result = apiInstance.testCodeInjectEnd(testCodeInjectEnd); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testCodeInjectEnd"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **testCodeInjectEnd** | **String**| To test code injection =end | [optional] - -### Return type - -[**Void**](.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json, */ =end'));(phpinfo(' - - **Accept**: application/json, */ end - # **testEndpointParameters** > Void testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password) diff --git a/samples/client/petstore/java/retrofit2/pom.xml b/samples/client/petstore/java/retrofit2/pom.xml index 3af9daa695e..9b832202144 100644 --- a/samples/client/petstore/java/retrofit2/pom.xml +++ b/samples/client/petstore/java/retrofit2/pom.xml @@ -68,6 +68,7 @@ org.codehaus.mojo build-helper-maven-plugin + 1.10 add_sources @@ -138,6 +139,7 @@ + UTF-8 1.7 ${java.version} ${java.version} diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java index ffb4c11be1d..87866795bf7 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java @@ -53,10 +53,10 @@ public class ApiClient { this(); for(String authName : authNames) { Interceptor auth; - if (authName == "petstore_auth") { - auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); - } else if (authName == "api_key") { + if (authName == "api_key") { auth = new ApiKeyAuth("header", "api_key"); + } else if (authName == "petstore_auth") { + auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } @@ -175,7 +175,7 @@ public class ApiClient { /** * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return + * @return Token request builder */ public TokenRequestBuilder getTokenEndPoint() { for(Interceptor apiAuthorization : apiAuthorizations.values()) { @@ -189,7 +189,7 @@ public class ApiClient { /** * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * @return + * @return Authentication request builder */ public AuthenticationRequestBuilder getAuthorizationEndPoint() { for(Interceptor apiAuthorization : apiAuthorizations.values()) { diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java index 004ba1916a5..aa1089ddbed 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java @@ -9,8 +9,8 @@ import retrofit2.http.*; import okhttp3.RequestBody; import org.joda.time.LocalDate; -import java.math.BigDecimal; import org.joda.time.DateTime; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; @@ -18,19 +18,6 @@ import java.util.List; import java.util.Map; public interface FakeApi { - /** - * To test code injection =end - * - * @param testCodeInjectEnd To test code injection =end (optional) - * @return Call - */ - - @FormUrlEncoded - @PUT("fake") - Call testCodeInjectEnd( - @Field("test code inject */ =end") String testCodeInjectEnd - ); - /** * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java index ec9d67a7449..dd39a864f06 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java @@ -9,8 +9,8 @@ import retrofit2.http.*; import okhttp3.RequestBody; import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; import java.io.File; +import io.swagger.client.model.ModelApiResponse; import java.util.ArrayList; import java.util.HashMap; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ArrayTest.java index b853a0b035a..8d58870bcdc 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/ArrayTest.java @@ -48,31 +48,6 @@ public class ArrayTest { @SerializedName("array_array_of_model") private List> arrayArrayOfModel = new ArrayList>(); - /** - * Gets or Sets arrayOfEnum - */ - public enum ArrayOfEnumEnum { - @SerializedName("UPPER") - UPPER("UPPER"), - - @SerializedName("lower") - LOWER("lower"); - - private String value; - - ArrayOfEnumEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("array_of_enum") - private List arrayOfEnum = new ArrayList(); - public ArrayTest arrayOfString(List arrayOfString) { this.arrayOfString = arrayOfString; return this; @@ -127,24 +102,6 @@ public class ArrayTest { this.arrayArrayOfModel = arrayArrayOfModel; } - public ArrayTest arrayOfEnum(List arrayOfEnum) { - this.arrayOfEnum = arrayOfEnum; - return this; - } - - /** - * Get arrayOfEnum - * @return arrayOfEnum - **/ - @ApiModelProperty(example = "null", value = "") - public List getArrayOfEnum() { - return arrayOfEnum; - } - - public void setArrayOfEnum(List arrayOfEnum) { - this.arrayOfEnum = arrayOfEnum; - } - @Override public boolean equals(java.lang.Object o) { @@ -157,13 +114,12 @@ public class ArrayTest { ArrayTest arrayTest = (ArrayTest) o; return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && - Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel) && - Objects.equals(this.arrayOfEnum, arrayTest.arrayOfEnum); + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); } @Override public int hashCode() { - return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel, arrayOfEnum); + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } @Override @@ -174,7 +130,6 @@ public class ArrayTest { sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); - sb.append(" arrayOfEnum: ").append(toIndentedString(arrayOfEnum)).append("\n"); sb.append("}"); return sb.toString(); } From 5608c739380c3d694345c504ff0580ea5e36d93f Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 5 Jul 2016 17:59:13 +0800 Subject: [PATCH 2/4] update pom to cover gralde, sbt, javadoc test --- .../java/retrofit2/.swagger-codegen-ignore | 2 + .../client/petstore/java/retrofit2/pom.xml | 49 +++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/samples/client/petstore/java/retrofit2/.swagger-codegen-ignore b/samples/client/petstore/java/retrofit2/.swagger-codegen-ignore index c5fa491b4c5..bca48b38e28 100644 --- a/samples/client/petstore/java/retrofit2/.swagger-codegen-ignore +++ b/samples/client/petstore/java/retrofit2/.swagger-codegen-ignore @@ -21,3 +21,5 @@ #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md + +pom.xml diff --git a/samples/client/petstore/java/retrofit2/pom.xml b/samples/client/petstore/java/retrofit2/pom.xml index 9b832202144..770278851e6 100644 --- a/samples/client/petstore/java/retrofit2/pom.xml +++ b/samples/client/petstore/java/retrofit2/pom.xml @@ -96,6 +96,55 @@ + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + gradle-test + integration-test + + exec + + + gradle + + check + + + + + sbt-test + integration-test + + exec + + + sbt + + publishLocal + + + + + mvn-javadoc-test + integration-test + + exec + + + mvn + + javadoc:javadoc + + + + + + From 5e6a6de351e9c0b95af412b20ef2ee0f29f331ef Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 5 Jul 2016 19:38:33 +0800 Subject: [PATCH 3/4] fix javadoc error --- .../libraries/retrofit2/ApiClient.mustache | 44 ++++++++--------- .../Java/libraries/retrofit2/api.mustache | 4 +- .../java/retrofit2/.swagger-codegen-ignore | 2 - .../client/petstore/java/retrofit2/pom.xml | 49 ------------------- .../java/io/swagger/client/ApiClient.java | 44 ++++++++--------- .../java/io/swagger/client/api/FakeApi.java | 8 +-- .../java/io/swagger/client/api/PetApi.java | 32 ++++++------ .../java/io/swagger/client/api/StoreApi.java | 16 +++--- .../java/io/swagger/client/api/UserApi.java | 32 ++++++------ 9 files changed, 90 insertions(+), 141 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache index 6ca343943cf..f9434978704 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache @@ -74,7 +74,7 @@ public class ApiClient { /** * Basic constructor for single auth name - * @param authName + * @param authName Authentication name */ public ApiClient(String authName) { this(new String[]{authName}); @@ -82,8 +82,8 @@ public class ApiClient { /** * Helper constructor for single api key - * @param authName - * @param apiKey + * @param authName Authentication name + * @param apiKey API key */ public ApiClient(String authName, String apiKey) { this(authName); @@ -92,9 +92,9 @@ public class ApiClient { /** * Helper constructor for single basic auth or password oauth2 - * @param authName - * @param username - * @param password + * @param authName Authentication name + * @param username Username + * @param password Password */ public ApiClient(String authName, String username, String password) { this(authName); @@ -103,11 +103,11 @@ public class ApiClient { /** * Helper constructor for single password oauth2 - * @param authName - * @param clientId - * @param secret - * @param username - * @param password + * @param authName Authentication name + * @param clientId Client ID + * @param secret Client Secret + * @param username Username + * @param password Password */ public ApiClient(String authName, String clientId, String secret, String username, String password) { this(authName); @@ -154,7 +154,7 @@ public class ApiClient { /** * Helper method to configure the first api key found - * @param apiKey + * @param apiKey API key */ private void setApiKey(String apiKey) { for(Interceptor apiAuthorization : apiAuthorizations.values()) { @@ -168,8 +168,8 @@ public class ApiClient { /** * Helper method to configure the username/password for basic auth or password oauth - * @param username - * @param password + * @param username Username + * @param password Password */ private void setCredentials(String username, String password) { for(Interceptor apiAuthorization : apiAuthorizations.values()) { @@ -216,7 +216,7 @@ public class ApiClient { /** * Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one) - * @param accessToken + * @param accessToken Access token */ public void setAccessToken(String accessToken) { for(Interceptor apiAuthorization : apiAuthorizations.values()) { @@ -230,9 +230,9 @@ public class ApiClient { /** * Helper method to configure the oauth accessCode/implicit flow parameters - * @param clientId - * @param clientSecret - * @param redirectURI + * @param clientId Client ID + * @param clientSecret Client secret + * @param redirectURI Redirect URI */ public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) { for(Interceptor apiAuthorization : apiAuthorizations.values()) { @@ -252,7 +252,7 @@ public class ApiClient { /** * Configures a listener which is notified when a new access token is received. - * @param accessTokenListener + * @param accessTokenListener Access token listener */ public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { for(Interceptor apiAuthorization : apiAuthorizations.values()) { @@ -266,8 +266,8 @@ public class ApiClient { /** * Adds an authorization to be used by the client - * @param authName - * @param authorization + * @param authName Authentication name + * @param authorization Authorization interceptor */ public void addAuthorization(String authName, Interceptor authorization) { if (apiAuthorizations.containsKey(authName)) { @@ -305,7 +305,7 @@ public class ApiClient { /** * Clones the okBuilder given in parameter, adds the auth interceptors and uses it to configure the Retrofit - * @param okClient + * @param okClient An instance of OK HTTP client */ public void configureFromOkclient(OkHttpClient okClient) { this.okBuilder = okClient.newBuilder(); diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/api.mustache index 9bd835a4a36..398cbe6a132 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/api.mustache @@ -25,12 +25,12 @@ public interface {{classname}} { * {{summary}} * {{notes}} {{#allParams}} * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} -{{/allParams}} * @return Call<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> +{{/allParams}} * @return Call[{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}] */ {{#formParams}}{{#-first}} {{#isMultipart}}@Multipart{{/isMultipart}}{{^isMultipart}}@FormUrlEncoded{{/isMultipart}}{{/-first}}{{/formParams}} @{{httpMethod}}("{{path}}") - {{#useRxJava}}Observable{{/useRxJava}}{{^useRxJava}}Call{{/useRxJava}}<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> {{operationId}}({{^allParams}});{{/allParams}} + {{#useRxJava}}Observable{{/useRxJava}}{{^useRxJava}}Call{{/useRxJava}}[{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}] {{operationId}}({{^allParams}});{{/allParams}} {{#allParams}}{{>libraries/retrofit2/queryParams}}{{>libraries/retrofit2/pathParams}}{{>libraries/retrofit2/headerParams}}{{>libraries/retrofit2/bodyParams}}{{>libraries/retrofit2/formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}} );{{/hasMore}}{{/allParams}} diff --git a/samples/client/petstore/java/retrofit2/.swagger-codegen-ignore b/samples/client/petstore/java/retrofit2/.swagger-codegen-ignore index bca48b38e28..c5fa491b4c5 100644 --- a/samples/client/petstore/java/retrofit2/.swagger-codegen-ignore +++ b/samples/client/petstore/java/retrofit2/.swagger-codegen-ignore @@ -21,5 +21,3 @@ #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md - -pom.xml diff --git a/samples/client/petstore/java/retrofit2/pom.xml b/samples/client/petstore/java/retrofit2/pom.xml index 770278851e6..9b832202144 100644 --- a/samples/client/petstore/java/retrofit2/pom.xml +++ b/samples/client/petstore/java/retrofit2/pom.xml @@ -96,55 +96,6 @@ - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - gradle-test - integration-test - - exec - - - gradle - - check - - - - - sbt-test - integration-test - - exec - - - sbt - - publishLocal - - - - - mvn-javadoc-test - integration-test - - exec - - - mvn - - javadoc:javadoc - - - - - - diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java index 87866795bf7..604861f6072 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java @@ -66,7 +66,7 @@ public class ApiClient { /** * Basic constructor for single auth name - * @param authName + * @param authName Authentication name */ public ApiClient(String authName) { this(new String[]{authName}); @@ -74,8 +74,8 @@ public class ApiClient { /** * Helper constructor for single api key - * @param authName - * @param apiKey + * @param authName Authentication name + * @param apiKey API key */ public ApiClient(String authName, String apiKey) { this(authName); @@ -84,9 +84,9 @@ public class ApiClient { /** * Helper constructor for single basic auth or password oauth2 - * @param authName - * @param username - * @param password + * @param authName Authentication name + * @param username Username + * @param password Password */ public ApiClient(String authName, String username, String password) { this(authName); @@ -95,11 +95,11 @@ public class ApiClient { /** * Helper constructor for single password oauth2 - * @param authName - * @param clientId - * @param secret - * @param username - * @param password + * @param authName Authentication name + * @param clientId Client ID + * @param secret Client Secret + * @param username Username + * @param password Password */ public ApiClient(String authName, String clientId, String secret, String username, String password) { this(authName); @@ -141,7 +141,7 @@ public class ApiClient { /** * Helper method to configure the first api key found - * @param apiKey + * @param apiKey API key */ private void setApiKey(String apiKey) { for(Interceptor apiAuthorization : apiAuthorizations.values()) { @@ -155,8 +155,8 @@ public class ApiClient { /** * Helper method to configure the username/password for basic auth or password oauth - * @param username - * @param password + * @param username Username + * @param password Password */ private void setCredentials(String username, String password) { for(Interceptor apiAuthorization : apiAuthorizations.values()) { @@ -203,7 +203,7 @@ public class ApiClient { /** * Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one) - * @param accessToken + * @param accessToken Access token */ public void setAccessToken(String accessToken) { for(Interceptor apiAuthorization : apiAuthorizations.values()) { @@ -217,9 +217,9 @@ public class ApiClient { /** * Helper method to configure the oauth accessCode/implicit flow parameters - * @param clientId - * @param clientSecret - * @param redirectURI + * @param clientId Client ID + * @param clientSecret Client secret + * @param redirectURI Redirect URI */ public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) { for(Interceptor apiAuthorization : apiAuthorizations.values()) { @@ -239,7 +239,7 @@ public class ApiClient { /** * Configures a listener which is notified when a new access token is received. - * @param accessTokenListener + * @param accessTokenListener Access token listener */ public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { for(Interceptor apiAuthorization : apiAuthorizations.values()) { @@ -253,8 +253,8 @@ public class ApiClient { /** * Adds an authorization to be used by the client - * @param authName - * @param authorization + * @param authName Authentication name + * @param authorization Authorization interceptor */ public void addAuthorization(String authName, Interceptor authorization) { if (apiAuthorizations.containsKey(authName)) { @@ -292,7 +292,7 @@ public class ApiClient { /** * Clones the okBuilder given in parameter, adds the auth interceptors and uses it to configure the Retrofit - * @param okClient + * @param okClient An instance of OK HTTP client */ public void configureFromOkclient(OkHttpClient okClient) { this.okBuilder = okClient.newBuilder(); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java index aa1089ddbed..4b2149758a7 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java @@ -33,12 +33,12 @@ public interface FakeApi { * @param date None (optional) * @param dateTime None (optional) * @param password None (optional) - * @return Call + * @return Call[Void] */ @FormUrlEncoded @POST("fake") - Call testEndpointParameters( + Call[Void] testEndpointParameters( @Field("number") BigDecimal number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") LocalDate date, @Field("dateTime") DateTime dateTime, @Field("password") String password ); @@ -48,12 +48,12 @@ public interface FakeApi { * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) - * @return Call + * @return Call[Void] */ @FormUrlEncoded @GET("fake") - Call testEnumQueryParameters( + Call[Void] testEnumQueryParameters( @Field("enum_query_string") String enumQueryString, @Query("enum_query_integer") BigDecimal enumQueryInteger, @Field("enum_query_double") Double enumQueryDouble ); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java index dd39a864f06..23e97996c66 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java @@ -22,11 +22,11 @@ public interface PetApi { * Add a new pet to the store * * @param body Pet object that needs to be added to the store (required) - * @return Call + * @return Call[Void] */ @POST("pet") - Call addPet( + Call[Void] addPet( @Body Pet body ); @@ -35,11 +35,11 @@ public interface PetApi { * * @param petId Pet id to delete (required) * @param apiKey (optional) - * @return Call + * @return Call[Void] */ @DELETE("pet/{petId}") - Call deletePet( + Call[Void] deletePet( @Path("petId") Long petId, @Header("api_key") String apiKey ); @@ -47,11 +47,11 @@ public interface PetApi { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter (required) - * @return Call> + * @return Call[List] */ @GET("pet/findByStatus") - Call> findPetsByStatus( + Call[List] findPetsByStatus( @Query("status") CSVParams status ); @@ -59,11 +59,11 @@ public interface PetApi { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by (required) - * @return Call> + * @return Call[List] */ @GET("pet/findByTags") - Call> findPetsByTags( + Call[List] findPetsByTags( @Query("tags") CSVParams tags ); @@ -71,11 +71,11 @@ public interface PetApi { * Find pet by ID * Returns a single pet * @param petId ID of pet to return (required) - * @return Call + * @return Call[Pet] */ @GET("pet/{petId}") - Call getPetById( + Call[Pet] getPetById( @Path("petId") Long petId ); @@ -83,11 +83,11 @@ public interface PetApi { * Update an existing pet * * @param body Pet object that needs to be added to the store (required) - * @return Call + * @return Call[Void] */ @PUT("pet") - Call updatePet( + Call[Void] updatePet( @Body Pet body ); @@ -97,12 +97,12 @@ public interface PetApi { * @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 Call + * @return Call[Void] */ @FormUrlEncoded @POST("pet/{petId}") - Call updatePetWithForm( + Call[Void] updatePetWithForm( @Path("petId") Long petId, @Field("name") String name, @Field("status") String status ); @@ -112,12 +112,12 @@ public interface PetApi { * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return Call + * @return Call[ModelApiResponse] */ @Multipart @POST("pet/{petId}/uploadImage") - Call uploadFile( + Call[ModelApiResponse] uploadFile( @Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file\"; filename=\"file\"") RequestBody file ); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java index 1651c07482c..97c331e1a58 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java @@ -20,33 +20,33 @@ public interface StoreApi { * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted (required) - * @return Call + * @return Call[Void] */ @DELETE("store/order/{orderId}") - Call deleteOrder( + Call[Void] deleteOrder( @Path("orderId") String orderId ); /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return Call> + * @return Call[Map] */ @GET("store/inventory") - Call> getInventory(); + Call[Map] getInventory(); /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched (required) - * @return Call + * @return Call[Order] */ @GET("store/order/{orderId}") - Call getOrderById( + Call[Order] getOrderById( @Path("orderId") Long orderId ); @@ -54,11 +54,11 @@ public interface StoreApi { * Place an order for a pet * * @param body order placed for purchasing the pet (required) - * @return Call + * @return Call[Order] */ @POST("store/order") - Call placeOrder( + Call[Order] placeOrder( @Body Order body ); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java index a0f17545a0f..0b4a60bb79e 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java @@ -20,11 +20,11 @@ public interface UserApi { * Create user * This can only be done by the logged in user. * @param body Created user object (required) - * @return Call + * @return Call[Void] */ @POST("user") - Call createUser( + Call[Void] createUser( @Body User body ); @@ -32,11 +32,11 @@ public interface UserApi { * Creates list of users with given input array * * @param body List of user object (required) - * @return Call + * @return Call[Void] */ @POST("user/createWithArray") - Call createUsersWithArrayInput( + Call[Void] createUsersWithArrayInput( @Body List body ); @@ -44,11 +44,11 @@ public interface UserApi { * Creates list of users with given input array * * @param body List of user object (required) - * @return Call + * @return Call[Void] */ @POST("user/createWithList") - Call createUsersWithListInput( + Call[Void] createUsersWithListInput( @Body List body ); @@ -56,11 +56,11 @@ public interface UserApi { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted (required) - * @return Call + * @return Call[Void] */ @DELETE("user/{username}") - Call deleteUser( + Call[Void] deleteUser( @Path("username") String username ); @@ -68,11 +68,11 @@ public interface UserApi { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. (required) - * @return Call + * @return Call[User] */ @GET("user/{username}") - Call getUserByName( + Call[User] getUserByName( @Path("username") String username ); @@ -81,22 +81,22 @@ public interface UserApi { * * @param username The user name for login (required) * @param password The password for login in clear text (required) - * @return Call + * @return Call[String] */ @GET("user/login") - Call loginUser( + Call[String] loginUser( @Query("username") String username, @Query("password") String password ); /** * Logs out current logged in user session * - * @return Call + * @return Call[Void] */ @GET("user/logout") - Call logoutUser(); + Call[Void] logoutUser(); /** @@ -104,11 +104,11 @@ public interface UserApi { * This can only be done by the logged in user. * @param username name that need to be deleted (required) * @param body Updated user object (required) - * @return Call + * @return Call[Void] */ @PUT("user/{username}") - Call updateUser( + Call[Void] updateUser( @Path("username") String username, @Body User body ); From 430f49aae6300137d30a48848b0648785bf35ec3 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 5 Jul 2016 20:38:04 +0800 Subject: [PATCH 4/4] fix javadoc error --- .../Java/libraries/retrofit2/api.mustache | 4 +-- .../java/io/swagger/client/api/FakeApi.java | 8 ++--- .../java/io/swagger/client/api/PetApi.java | 32 +++++++++---------- .../java/io/swagger/client/api/StoreApi.java | 16 +++++----- .../java/io/swagger/client/api/UserApi.java | 32 +++++++++---------- 5 files changed, 46 insertions(+), 46 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/api.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/api.mustache index 398cbe6a132..7fa42fe732c 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/api.mustache @@ -25,12 +25,12 @@ public interface {{classname}} { * {{summary}} * {{notes}} {{#allParams}} * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} -{{/allParams}} * @return Call[{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}] +{{/allParams}} * @return Call<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> */ {{#formParams}}{{#-first}} {{#isMultipart}}@Multipart{{/isMultipart}}{{^isMultipart}}@FormUrlEncoded{{/isMultipart}}{{/-first}}{{/formParams}} @{{httpMethod}}("{{path}}") - {{#useRxJava}}Observable{{/useRxJava}}{{^useRxJava}}Call{{/useRxJava}}[{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}] {{operationId}}({{^allParams}});{{/allParams}} + {{#useRxJava}}Observable{{/useRxJava}}{{^useRxJava}}Call{{/useRxJava}}<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> {{operationId}}({{^allParams}});{{/allParams}} {{#allParams}}{{>libraries/retrofit2/queryParams}}{{>libraries/retrofit2/pathParams}}{{>libraries/retrofit2/headerParams}}{{>libraries/retrofit2/bodyParams}}{{>libraries/retrofit2/formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}} );{{/hasMore}}{{/allParams}} diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java index 4b2149758a7..042a6ba37e5 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java @@ -33,12 +33,12 @@ public interface FakeApi { * @param date None (optional) * @param dateTime None (optional) * @param password None (optional) - * @return Call[Void] + * @return Call<Void> */ @FormUrlEncoded @POST("fake") - Call[Void] testEndpointParameters( + Call testEndpointParameters( @Field("number") BigDecimal number, @Field("double") Double _double, @Field("string") String string, @Field("byte") byte[] _byte, @Field("integer") Integer integer, @Field("int32") Integer int32, @Field("int64") Long int64, @Field("float") Float _float, @Field("binary") byte[] binary, @Field("date") LocalDate date, @Field("dateTime") DateTime dateTime, @Field("password") String password ); @@ -48,12 +48,12 @@ public interface FakeApi { * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) - * @return Call[Void] + * @return Call<Void> */ @FormUrlEncoded @GET("fake") - Call[Void] testEnumQueryParameters( + Call testEnumQueryParameters( @Field("enum_query_string") String enumQueryString, @Query("enum_query_integer") BigDecimal enumQueryInteger, @Field("enum_query_double") Double enumQueryDouble ); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java index 23e97996c66..a55cb2ee17f 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java @@ -22,11 +22,11 @@ public interface PetApi { * Add a new pet to the store * * @param body Pet object that needs to be added to the store (required) - * @return Call[Void] + * @return Call<Void> */ @POST("pet") - Call[Void] addPet( + Call addPet( @Body Pet body ); @@ -35,11 +35,11 @@ public interface PetApi { * * @param petId Pet id to delete (required) * @param apiKey (optional) - * @return Call[Void] + * @return Call<Void> */ @DELETE("pet/{petId}") - Call[Void] deletePet( + Call deletePet( @Path("petId") Long petId, @Header("api_key") String apiKey ); @@ -47,11 +47,11 @@ public interface PetApi { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter (required) - * @return Call[List] + * @return Call<List> */ @GET("pet/findByStatus") - Call[List] findPetsByStatus( + Call> findPetsByStatus( @Query("status") CSVParams status ); @@ -59,11 +59,11 @@ public interface PetApi { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by (required) - * @return Call[List] + * @return Call<List> */ @GET("pet/findByTags") - Call[List] findPetsByTags( + Call> findPetsByTags( @Query("tags") CSVParams tags ); @@ -71,11 +71,11 @@ public interface PetApi { * Find pet by ID * Returns a single pet * @param petId ID of pet to return (required) - * @return Call[Pet] + * @return Call<Pet> */ @GET("pet/{petId}") - Call[Pet] getPetById( + Call getPetById( @Path("petId") Long petId ); @@ -83,11 +83,11 @@ public interface PetApi { * Update an existing pet * * @param body Pet object that needs to be added to the store (required) - * @return Call[Void] + * @return Call<Void> */ @PUT("pet") - Call[Void] updatePet( + Call updatePet( @Body Pet body ); @@ -97,12 +97,12 @@ public interface PetApi { * @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 Call[Void] + * @return Call<Void> */ @FormUrlEncoded @POST("pet/{petId}") - Call[Void] updatePetWithForm( + Call updatePetWithForm( @Path("petId") Long petId, @Field("name") String name, @Field("status") String status ); @@ -112,12 +112,12 @@ public interface PetApi { * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return Call[ModelApiResponse] + * @return Call<ModelApiResponse> */ @Multipart @POST("pet/{petId}/uploadImage") - Call[ModelApiResponse] uploadFile( + Call uploadFile( @Path("petId") Long petId, @Part("additionalMetadata") String additionalMetadata, @Part("file\"; filename=\"file\"") RequestBody file ); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java index 97c331e1a58..3e19600bedb 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/StoreApi.java @@ -20,33 +20,33 @@ public interface StoreApi { * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @param orderId ID of the order that needs to be deleted (required) - * @return Call[Void] + * @return Call<Void> */ @DELETE("store/order/{orderId}") - Call[Void] deleteOrder( + Call deleteOrder( @Path("orderId") String orderId ); /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return Call[Map] + * @return Call<Map> */ @GET("store/inventory") - Call[Map] getInventory(); + Call> getInventory(); /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched (required) - * @return Call[Order] + * @return Call<Order> */ @GET("store/order/{orderId}") - Call[Order] getOrderById( + Call getOrderById( @Path("orderId") Long orderId ); @@ -54,11 +54,11 @@ public interface StoreApi { * Place an order for a pet * * @param body order placed for purchasing the pet (required) - * @return Call[Order] + * @return Call<Order> */ @POST("store/order") - Call[Order] placeOrder( + Call placeOrder( @Body Order body ); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java index 0b4a60bb79e..3fc76b6a1b2 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/UserApi.java @@ -20,11 +20,11 @@ public interface UserApi { * Create user * This can only be done by the logged in user. * @param body Created user object (required) - * @return Call[Void] + * @return Call<Void> */ @POST("user") - Call[Void] createUser( + Call createUser( @Body User body ); @@ -32,11 +32,11 @@ public interface UserApi { * Creates list of users with given input array * * @param body List of user object (required) - * @return Call[Void] + * @return Call<Void> */ @POST("user/createWithArray") - Call[Void] createUsersWithArrayInput( + Call createUsersWithArrayInput( @Body List body ); @@ -44,11 +44,11 @@ public interface UserApi { * Creates list of users with given input array * * @param body List of user object (required) - * @return Call[Void] + * @return Call<Void> */ @POST("user/createWithList") - Call[Void] createUsersWithListInput( + Call createUsersWithListInput( @Body List body ); @@ -56,11 +56,11 @@ public interface UserApi { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted (required) - * @return Call[Void] + * @return Call<Void> */ @DELETE("user/{username}") - Call[Void] deleteUser( + Call deleteUser( @Path("username") String username ); @@ -68,11 +68,11 @@ public interface UserApi { * Get user by user name * * @param username The name that needs to be fetched. Use user1 for testing. (required) - * @return Call[User] + * @return Call<User> */ @GET("user/{username}") - Call[User] getUserByName( + Call getUserByName( @Path("username") String username ); @@ -81,22 +81,22 @@ public interface UserApi { * * @param username The user name for login (required) * @param password The password for login in clear text (required) - * @return Call[String] + * @return Call<String> */ @GET("user/login") - Call[String] loginUser( + Call loginUser( @Query("username") String username, @Query("password") String password ); /** * Logs out current logged in user session * - * @return Call[Void] + * @return Call<Void> */ @GET("user/logout") - Call[Void] logoutUser(); + Call logoutUser(); /** @@ -104,11 +104,11 @@ public interface UserApi { * This can only be done by the logged in user. * @param username name that need to be deleted (required) * @param body Updated user object (required) - * @return Call[Void] + * @return Call<Void> */ @PUT("user/{username}") - Call[Void] updateUser( + Call updateUser( @Path("username") String username, @Body User body );