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

Feature request: support for deprecated endpoints #190

Open
asqarslanov opened this issue Feb 16, 2025 · 3 comments
Open

Feature request: support for deprecated endpoints #190

asqarslanov opened this issue Feb 16, 2025 · 3 comments

Comments

@asqarslanov
Copy link

I couldn't find a way to mark an endpoint as deprecated with Aide.

For example, Utoipa (which uses macros to generate documentation), makes use of Rust’s #[deprecated] attribute (https://docs.rs/utoipa/latest/utoipa/attr.path.html).

A deprecated endpoint should look like this (in Swagger):

Image

Here is its raw OpenAPI JSON (simplified):

"/some/deprecated/route": {
  "get": {
    "summary": "Guys, don't use this endpoint anymore.",
    "deprecated": true
  }
}

Aide could use the following syntax for this feature:

ApiRouter::new()
    .api_route(
        "/path/to/route",
        get_with(handler, |o| o.deprecated()),
    )
@JakkuSakura
Copy link
Collaborator

Should not be hard to add this. I was wondering if there's a better syntax

@asqarslanov
Copy link
Author

Should not be hard to add this. I was wondering if there's a better syntax

The only alternative I can imagine is also accepting a boolean parameter:

.api_route(
    "/path/to/route",
    get_with(handler, |o| o.deprecated(true)),
)

But to think of it, who would pass .deprecated(false)? 😁

@jplatte
Copy link
Collaborator

jplatte commented Feb 16, 2025

I think this is currently possible using o.inner_mut().deprecated = true;.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants