Skip to content

Conversation

@hovinen
Copy link
Contributor

@hovinen hovinen commented Oct 14, 2025

Previously, if an API endpoint was marked deprecated, this fact was not reflected in the generated Rust clients using the reqwest library. We want to know exactly when our client code is using a deprecated endpoint, so marking the corresponding functions with the #[deprecatd] attribute would be very helpful. Uses of the endpoint would then be picked up by linters so that we can react.

This adds a line to the template which marks functions generated from deprecated endpoints with the #[deprecated] attribute.

This does not touch any of the other client generators for Rust or any other language, since they are out of scope for our needs.

Unfortunately, even after about a dozen attempts, I was unable to coax Mustache into not introducing an extra vertical whitespace when the #[deprecated] attribute is absent. This has no effect on functionality of the generated code, but is visually unappealing.

@frol @farcaller @richardwhiuk @paladinzh @jacob-pro @dsteeley

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • 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.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Previously, if an API endpoint was marked deprecated, this fact was not
reflected in the generated Rust clients using the reqwest library. We
want to know exactly when our client code is using a deprecated endpoint,
so marking the corresponding functions with the `#[deprecatd]` attribute
would be very helpful. Uses of the endpoint would then be picked up by
linters so that we can react.

This adds a line to the template which marks functions generated from
deprecated endpoints with the `#[deprecated]` attribute.

This does not touch any of the other client generators for Rust or any
other language, since they are out of scope for our needs.
@hovinen hovinen force-pushed the support-deprecated-api-endpoints-in-rust branch from d9636b8 to c823e05 Compare October 16, 2025 09:55
@hovinen hovinen requested a review from wing328 October 16, 2025 11:18
@wing328 wing328 merged commit 40b9d69 into OpenAPITools:master Oct 16, 2025
17 checks passed
@wing328
Copy link
Member

wing328 commented Oct 16, 2025

thanks for the contribution, which has been merged

@hovinen
Copy link
Contributor Author

hovinen commented Oct 16, 2025

thanks for the contribution, which has been merged

Thank you!

One question: When will there be a new release containing this change?

@wing328
Copy link
Member

wing328 commented Oct 19, 2025

please refer to the milestone page: https://github.com/OpenAPITools/openapi-generator/milestones

rajvesh pushed a commit to rajvesh/openapi-generator that referenced this pull request Dec 25, 2025
…PITools#22131)

Previously, if an API endpoint was marked deprecated, this fact was not
reflected in the generated Rust clients using the reqwest library. We
want to know exactly when our client code is using a deprecated endpoint,
so marking the corresponding functions with the `#[deprecatd]` attribute
would be very helpful. Uses of the endpoint would then be picked up by
linters so that we can react.

This adds a line to the template which marks functions generated from
deprecated endpoints with the `#[deprecated]` attribute.

This does not touch any of the other client generators for Rust or any
other language, since they are out of scope for our needs.

Co-authored-by: Bradford Hovinen <[email protected]>
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.

2 participants