Skip to content

[Java][WebClient] Add @Deprecated to main and WithResponseSpec methods of deprecated operations - #25128

Merged
wing328 merged 2 commits into
OpenAPITools:masterfrom
ondrej-simon:b/webclient-deprecated-annotation
Oct 5, 2026
Merged

wing328 merged 2 commits into
OpenAPITools:masterfrom
ondrej-simon:b/webclient-deprecated-annotation

Conversation

@ondrej-simon

@ondrej-simon ondrej-simon commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #25127.

For a deprecated operation, the Java webclient library generates three public methods, but only operationWithHttpInfo(...) was annotated with @Deprecated (added in #23039). This PR adds the same @Deprecated annotation and @deprecated Javadoc tag to the other two public methods, operation(...) and operationWithResponseSpec(...), so that all entry points of a deprecated endpoint trigger deprecation warnings (e.g. with javac -Xlint:deprecation -Werror). This also covers the method originally reported in #22675.

Changes:

  • Java/libraries/webclient/api.mustache: add {{#isDeprecated}} blocks to {{operationId}} and {{operationId}}WithResponseSpec.
  • New test JavaClientCodegenTest#testWebClientDeprecatedOperation: asserts all three methods of the deprecated findPetsByTags are annotated, and none of the non-deprecated findPetsByStatus are. The test fails without the template change.
  • Regenerated bin/configs/java-webclient*.yaml samples (no other configs use the webclient library). Only the four petstore PetApi.java samples containing the deprecated findPetsByTags operation change.

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

cc Java technical committee: @bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608 @martin-mfg @KannaKim


Summary by cubic

Fixes #25127. Applies the @Deprecated annotation and @deprecated Javadoc tag to the operation(...) and operationWithResponseSpec(...) methods of deprecated operations in the Java webclient library, matching the existing annotation on operationWithHttpInfo(...) so all entry points trigger deprecation warnings.

  • Adds a regression test asserting all three methods of a deprecated operation are annotated and carry the @deprecated Javadoc tag, while deprecated methods of non-deprecated operations remain untouched.
  • Regenerates java-webclient* sample PetApi.java files affected by the template change.

Written for commit 6f3379f. Summary will update on new commits.

Review in cubic

…s of deprecated operations

OpenAPITools#23039 only annotated the WithHttpInfo method. Apply the same @deprecated
annotation and @deprecated javadoc tag to the main operation method and
the WithResponseSpec method, and add a regression test.

Fixes OpenAPITools#25127

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files

Reply to a comment to ask cubic a question or push back. It learns from your replies.

Re-trigger cubic

@wing328
wing328 merged commit 43b4130 into OpenAPITools:master Oct 5, 2026
134 of 135 checks passed
@wing328 wing328 added this to the 7.26.0 milestone Oct 5, 2026
@ondrej-simon
ondrej-simon deleted the b/webclient-deprecated-annotation branch October 6, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][JAVA][webclient] Deprecated operations are not annotated with @Deprecated on the main and WithResponseSpec methods

2 participants