aide icon indicating copy to clipboard operation
aide copied to clipboard

Feature request: support for deprecated endpoints

Open asqarslanov opened this issue 10 months ago • 3 comments

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()),
    )

asqarslanov avatar Feb 16 '25 00:02 asqarslanov

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

JakkuSakura avatar Feb 16 '25 05:02 JakkuSakura

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)? 😁

asqarslanov avatar Feb 16 '25 10:02 asqarslanov

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

jplatte avatar Feb 16 '25 12:02 jplatte