Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java][Client] Fix Deprecated annotation of deprecated operations #1306

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/resources/handlebars/Java/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ public class {{classname}} {
* @return {{returnType}}
{{/returnType}}
* @throws ApiException if fails to make API call
{{#isDeprecated}}
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/isDeprecated}}
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
*/
{{#isDeprecated}}
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/isDeprecated}}
{{/vendorExtensions.x-is-deprecated}}
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#parameters}}{{{dataType}}} {{paramName}}{{#has this 'more'}}, {{/has}}{{/parameters}}) throws ApiException {
Object {{localVariablePrefix}}localVarPostBody = {{^isForm}}{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}{{/isForm}}{{#isForm}}null{{/isForm}};
{{#parameters}}{{#required}}
Expand Down
12 changes: 12 additions & 0 deletions src/main/resources/handlebars/Java/libraries/feign/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,17 @@ public interface {{classname}} extends ApiClient.Api {
{{#returnType}}
* @return {{returnType}}
{{/returnType}}
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
*/
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/vendorExtensions.x-is-deprecated}}
@RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{braces "left"}}{{paramName}}{{braces "right"}}{{#has this 'more'}}&{{/has}}{{/queryParams}}")
@Headers({
{{#vendorExtensions.x-contentType}}
Expand Down Expand Up @@ -78,10 +84,16 @@ public interface {{classname}} extends ApiClient.Api {
{{#returnType}}
* @return {{returnType}}
{{/returnType}}
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>{{/externalDocs}}
*/
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/vendorExtensions.x-is-deprecated}}
@RequestLine("{{httpMethod}} {{{path}}}?{{#queryParams}}{{baseName}}={{braces "left"}}{{paramName}}{{braces "right"}}{{#has this 'more'}}&{{/has}}{{/queryParams}}")
@Headers({
{{#vendorExtensions.x-contentType}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ public class {{classname}} {
* @return {{returnType}}
{{/returnType}}
* @throws ApiException if fails to make API call
{{#isDeprecated}}
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/isDeprecated}}
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
*/
{{#isDeprecated}}
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/isDeprecated}}
{{/vendorExtensions.x-is-deprecated}}
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#parameters}}{{{dataType}}} {{paramName}}{{#has this 'more'}}, {{/has}}{{/parameters}}) throws ApiException {
Object {{localVariablePrefix}}localVarPostBody = {{^isForm}}{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}{{/isForm}}{{#isForm}}null{{/isForm}};
{{#parameters}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ public class {{classname}} {
* @return {{returnType}}
{{/returnType}}
* @throws ApiException if fails to make API call
{{#isDeprecated}}
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/isDeprecated}}
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
*/
{{#isDeprecated}}
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/isDeprecated}}
{{/vendorExtensions.x-is-deprecated}}
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#parameters}}{{{dataType}}} {{paramName}}{{#has this 'more'}}, {{/has}}{{/parameters}}) throws ApiException {
Object {{localVariablePrefix}}localVarPostBody = {{^isForm}}{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}{{/isForm}}{{#isForm}}null{{/isForm}};
{{#parameters}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,17 @@ public class {{classname}} {
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
{{#externalDocs}}
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
{{/externalDocs}}
*/
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/vendorExtensions.x-is-deprecated}}
public com.squareup.okhttp.Call {{operationId}}Call({{#parameters}}{{{dataType}}} {{paramName}}, {{/parameters}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object {{localVariablePrefix}}localVarPostBody = {{^isForm}}{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}{{/isForm}}{{#isForm}}null{{/isForm}};

Expand Down Expand Up @@ -201,11 +207,17 @@ public class {{classname}} {
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/parameters}}{{#returnType}}
* @return {{returnType}}{{/returnType}}
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
{{#externalDocs}}
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
{{/externalDocs}}
*/
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/vendorExtensions.x-is-deprecated}}
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#parameters}}{{{dataType}}} {{paramName}}{{#has this 'more'}}, {{/has}}{{/parameters}}) throws ApiException {
{{#returnType}}ApiResponse<{{{returnType}}}> {{localVariablePrefix}}resp = {{/returnType}}{{operationId}}WithHttpInfo({{#parameters}}{{paramName}}{{#has this 'more'}}, {{/has}}{{/parameters}});{{#returnType}}
return {{localVariablePrefix}}resp.getData();{{/returnType}}
Expand All @@ -217,11 +229,17 @@ public class {{classname}} {
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/parameters}}
* @return ApiResponse&lt;{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
{{#externalDocs}}
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
{{/externalDocs}}
*/
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/vendorExtensions.x-is-deprecated}}
public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#parameters}}{{#if useBeanValidation}}{{>beanValidationQueryParams}}{{/if}}{{{dataType}}} {{paramName}}{{#has this 'more'}}, {{/has}}{{/parameters}}) throws ApiException {
com.squareup.okhttp.Call {{localVariablePrefix}}call = {{operationId}}ValidateBeforeCall({{#parameters}}{{paramName}}, {{/parameters}}null, null);
{{#returnType}}Type {{localVariablePrefix}}localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();
Expand All @@ -235,11 +253,17 @@ public class {{classname}} {
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
{{#externalDocs}}
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
{{/externalDocs}}
*/
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/vendorExtensions.x-is-deprecated}}
public com.squareup.okhttp.Call {{operationId}}Async({{#parameters}}{{{dataType}}} {{paramName}}, {{/parameters}}final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{localVariablePrefix}}callback) throws ApiException {

ProgressResponseBody.ProgressListener progressListener = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,17 @@ public class {{classname}} {
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
{{#externalDocs}}
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
{{/externalDocs}}
*/
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/vendorExtensions.x-is-deprecated}}
public okhttp3.Call {{operationId}}Call({{#parameters}}{{{dataType}}} {{paramName}}, {{/parameters}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object {{localVariablePrefix}}localVarPostBody = {{^isForm}}{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}{{/isForm}}{{#isForm}}null{{/isForm}};

Expand Down Expand Up @@ -128,9 +134,6 @@ public class {{classname}} {
return {{localVariablePrefix}}apiClient.buildCall({{localVariablePrefix}}localVarPath, "{{httpMethod}}", {{localVariablePrefix}}localVarQueryParams, {{localVariablePrefix}}localVarCollectionQueryParams, {{localVariablePrefix}}localVarPostBody, {{localVariablePrefix}}localVarHeaderParams, {{localVariablePrefix}}localVarFormParams, {{localVariablePrefix}}localVarAuthNames, progressRequestListener);
}

{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
@SuppressWarnings("rawtypes")
private okhttp3.Call {{operationId}}ValidateBeforeCall({{#parameters}}{{{dataType}}} {{paramName}}, {{/parameters}}final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
{{^performBeanValidation}}
Expand Down Expand Up @@ -179,11 +182,17 @@ public class {{classname}} {
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/parameters}}{{#returnType}}
* @return {{returnType}}{{/returnType}}
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
{{#externalDocs}}
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
{{/externalDocs}}
*/
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/vendorExtensions.x-is-deprecated}}
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#parameters}}{{{dataType}}} {{paramName}}{{#has this 'more'}}, {{/has}}{{/parameters}}) throws ApiException {
{{#returnType}}ApiResponse<{{{returnType}}}> {{localVariablePrefix}}resp = {{/returnType}}{{operationId}}WithHttpInfo({{#parameters}}{{paramName}}{{#has this 'more'}}, {{/has}}{{/parameters}});{{#returnType}}
return {{localVariablePrefix}}resp.getData();{{/returnType}}
Expand All @@ -195,11 +204,17 @@ public class {{classname}} {
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/parameters}}
* @return ApiResponse&lt;{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
{{#externalDocs}}
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
{{/externalDocs}}
*/
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/vendorExtensions.x-is-deprecated}}
public ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#parameters}}{{#if useBeanValidation}}{{>beanValidationQueryParams}}{{/if}}{{{dataType}}} {{paramName}}{{#has this 'more'}}, {{/has}}{{/parameters}}) throws ApiException {
okhttp3.Call {{localVariablePrefix}}call = {{operationId}}ValidateBeforeCall({{#parameters}}{{paramName}}, {{/parameters}}null, null);
{{#returnType}}Type {{localVariablePrefix}}localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();
Expand All @@ -213,11 +228,17 @@ public class {{classname}} {
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
{{#externalDocs}}
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
{{/externalDocs}}
*/
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/vendorExtensions.x-is-deprecated}}
public okhttp3.Call {{operationId}}Async({{#parameters}}{{{dataType}}} {{paramName}}, {{/parameters}}final ApiCallback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{localVariablePrefix}}callback) throws ApiException {

ProgressResponseBody.ProgressListener progressListener = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ public class {{classname}} {
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/parameters}}{{#returnType}}
* @return {{{returnType}}}{{/returnType}}
* @throws ApiException if fails to make API call
{{#isDeprecated}}
{{#vendorExtension.x-is-enum}}
* @deprecated
{{/isDeprecated}}
{{/vendorExtension.x-is-enum}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
*/
{{#isDeprecated}}
{{#vendorExtension.x-is-enum}}
@Deprecated
{{/isDeprecated}}
{{/vendorExtension.x-is-enum}}
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#parameters}}{{{dataType}}} {{paramName}}{{#has this 'more'}}, {{/has}}{{/parameters}}) throws ApiException {
Object {{localVariablePrefix}}localVarPostBody = {{^isForm}}{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}{{/isForm}}{{#isForm}}null{{/isForm}};
{{#parameters}}{{#required}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,17 @@ public class {{classname}} {
* @return {{returnType}}
{{/returnType}}
* @throws RestClientException if an error occurs while attempting to invoke the API
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
*/
{{#isDeprecated}}
{{#vendorExtension.x-is-enum}}
@Deprecated
{{/isDeprecated}}
{{/vendorExtension.x-is-enum}}
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#parameters}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/parameters}}) throws RestClientException {
{{#returnType}}
return {{operationId}}WithHttpInfo({{#parameters}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/parameters}}).getBody();
Expand All @@ -91,14 +94,17 @@ public class {{classname}} {
{{/parameters}}
* @return ResponseEntity&lt;{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}&gt;
* @throws RestClientException if an error occurs while attempting to invoke the API
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
*/
{{#isDeprecated}}
{{#vendorExtension.x-is-enum}}
@Deprecated
{{/isDeprecated}}
{{/vendorExtension.x-is-enum}}
public ResponseEntity<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#parameters}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/parameters}}) throws RestClientException {
Object {{localVariablePrefix}}postBody = {{^isForm}}{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}{{/isForm}}{{#isForm}}null{{/isForm}};
{{#parameters}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public interface {{classname}} {
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/parameters}}
* @param cb callback method
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
Expand All @@ -72,6 +75,9 @@ public interface {{classname}} {
{{/@first}}
{{/formParams}}
@{{httpMethod}}("{{{path}}}")
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/vendorExtensions.x-is-deprecated}}
void {{operationId}}(
{{#parameters}}{{>libraries/retrofit/queryParams}}{{>libraries/retrofit/pathParams}}{{>libraries/retrofit/headerParams}}{{>libraries/retrofit/bodyParams}}{{>libraries/retrofit/formParams}}{{>libraries/retrofit/cookieParams}}, {{/parameters}}Callback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> cb
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,17 @@ public interface {{classname}} {
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/parameters}}
* @return Call&lt;{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Object{{/returnType}}&gt;
{{#vendorExtensions.x-is-deprecated}}
* @deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
*/
{{#vendorExtensions.x-is-deprecated}}
@Deprecated
{{/vendorExtensions.x-is-deprecated}}
{{#formParams}}
{{#@first}}
{{#is ../this 'multipart'}}@retrofit2.http.Multipart{{/is}}{{#isNot ../this 'multipart'}}@retrofit2.http.FormUrlEncoded{{/isNot}}
Expand Down
Loading