juhaku / utoipa

Simple, Fast, Code first and Compile time generated OpenAPI documentation for Rust
Apache License 2.0
2.48k stars 197 forks source link

Same endpoint, different methods, but only one is registered #1185

Open slekup opened 2 weeks ago

slekup commented 2 weeks ago

If I have two routes, like:

#[utoipa::path(
    patch,
    path = "/",
    tag = "Users",
)]
pub async fn update_user_handler() { ... }

#[utoipa::path(
    delete,
    path = "/",
    tag = "Users",
)]
pub async fn delete_user_handler() { ... }

only one of them registers. If I change the path of one of them to something different, both of them register.

How could I register both of them with the same path, but different methods? Or is this a bug?

juhaku commented 2 weeks ago

@slekup How did you register those 2 handlers? Did you use axum or what library you are using? Just based on above statement it is impossible to tell what is possibly wrong and where.

slekup commented 2 weeks ago

I am using axum. I'm registering them like:

OpenApiRouter::new()
    .routes(routes!(update_user::update_user_handler))
    .routes(routes!(delete_user::delete_user_handler))