Skip to content

Commit 8c70c33

Browse files
authored
[Java][WebClient] Propagate OpenAPI Deprecations to Generated ApiClient-methods (#23039)
Signed-off-by: Chrimle <28791817+Chrimle@users.noreply.github.com>
1 parent f4b64c4 commit 8c70c33

5 files changed

Lines changed: 14 additions & 0 deletions

File tree

  • modules/openapi-generator/src/main/resources/Java/libraries/webclient
  • samples/client/petstore/java
    • webclient-jakarta/src/main/java/org/openapitools/client/api
    • webclient-swagger2/src/main/java/org/openapitools/client/api
    • webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api
    • webclient/src/main/java/org/openapitools/client/api

modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,13 @@ public class {{classname}} {
196196
* {{description}}
197197
* @see <a href="{{url}}">{{summary}} Documentation</a>
198198
{{/externalDocs}}
199+
{{#isDeprecated}}
200+
* @deprecated
201+
{{/isDeprecated}}
199202
*/
203+
{{#isDeprecated}}
204+
@Deprecated
205+
{{/isDeprecated}}
200206
public {{#vendorExtensions.x-webclient-blocking}}{{#returnType}}{{#vendorExtensions.x-webclient-return-except-list-of-string}}ResponseEntity<List<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnBaseType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnBaseType}}}{{/isResponseFile}}>>{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}ResponseEntity<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}>{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{/returnType}}{{^returnType}}ResponseEntity<Void>{{/returnType}} {{/vendorExtensions.x-webclient-blocking}}{{^vendorExtensions.x-webclient-blocking}}{{#returnType}}{{#vendorExtensions.x-webclient-return-except-list-of-string}}Mono<ResponseEntity<List<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnBaseType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnBaseType}}}{{/isResponseFile}}>>>{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}Mono<ResponseEntity<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}>>{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{/returnType}}{{^returnType}}Mono<ResponseEntity<Void>>{{/returnType}} {{/vendorExtensions.x-webclient-blocking}}{{operationId}}WithHttpInfo({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection<org.springframework.core.io.AbstractResource>{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{>nullable_var_annotations}} {{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{>nullable_var_annotations}} {{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws WebClientResponseException {
201207
{{#returnType}}ParameterizedTypeReference<{{#vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnBaseType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnBaseType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}> localVarReturnType = new ParameterizedTypeReference<{{#vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnBaseType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnBaseType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}{{/vendorExtensions.x-webclient-return-except-list-of-string}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference<Void> localVarReturnType = new ParameterizedTypeReference<Void>() {};{{/returnType}}
202208
return {{operationId}}RequestCreation({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).{{#vendorExtensions.x-webclient-return-except-list-of-string}}toEntityList{{/vendorExtensions.x-webclient-return-except-list-of-string}}{{^vendorExtensions.x-webclient-return-except-list-of-string}}toEntity{{/vendorExtensions.x-webclient-return-except-list-of-string}}(localVarReturnType){{#vendorExtensions.x-webclient-blocking}}.block(){{/vendorExtensions.x-webclient-blocking}};

samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/PetApi.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,9 @@ public Set<Pet> findPetsByTags(@jakarta.annotation.Nonnull Set<String> tags) thr
344344
* @param tags Tags to filter by
345345
* @return ResponseEntity&lt;Set&lt;Pet&gt;&gt;
346346
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
347+
* @deprecated
347348
*/
349+
@Deprecated
348350
public ResponseEntity<List<Pet>> findPetsByTagsWithHttpInfo(@jakarta.annotation.Nonnull Set<String> tags) throws WebClientResponseException {
349351
ParameterizedTypeReference<Pet> localVarReturnType = new ParameterizedTypeReference<Pet>() {};
350352
return findPetsByTagsRequestCreation(tags).toEntityList(localVarReturnType).block();

samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/PetApi.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,9 @@ public Set<Pet> findPetsByTags(@javax.annotation.Nonnull Set<String> tags) throw
344344
* @param tags Tags to filter by
345345
* @return ResponseEntity&lt;Set&lt;Pet&gt;&gt;
346346
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
347+
* @deprecated
347348
*/
349+
@Deprecated
348350
public ResponseEntity<List<Pet>> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull Set<String> tags) throws WebClientResponseException {
349351
ParameterizedTypeReference<Pet> localVarReturnType = new ParameterizedTypeReference<Pet>() {};
350352
return findPetsByTagsRequestCreation(tags).toEntityList(localVarReturnType).block();

samples/client/petstore/java/webclient-useSingleRequestParameter/src/main/java/org/openapitools/client/api/PetApi.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,9 @@ public Set<Pet> findPetsByTags(@javax.annotation.Nonnull Set<String> tags) throw
428428
* @param tags Tags to filter by
429429
* @return ResponseEntity&lt;Set&lt;Pet&gt;&gt;
430430
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
431+
* @deprecated
431432
*/
433+
@Deprecated
432434
public ResponseEntity<List<Pet>> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull Set<String> tags) throws WebClientResponseException {
433435
ParameterizedTypeReference<Pet> localVarReturnType = new ParameterizedTypeReference<Pet>() {};
434436
return findPetsByTagsRequestCreation(tags).toEntityList(localVarReturnType).block();

samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,9 @@ public Set<Pet> findPetsByTags(@javax.annotation.Nonnull Set<String> tags) throw
344344
* @param tags Tags to filter by
345345
* @return ResponseEntity&lt;Set&lt;Pet&gt;&gt;
346346
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
347+
* @deprecated
347348
*/
349+
@Deprecated
348350
public ResponseEntity<List<Pet>> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull Set<String> tags) throws WebClientResponseException {
349351
ParameterizedTypeReference<Pet> localVarReturnType = new ParameterizedTypeReference<Pet>() {};
350352
return findPetsByTagsRequestCreation(tags).toEntityList(localVarReturnType).block();

0 commit comments

Comments
 (0)