WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Feature request: Using Axum optional path routes #1485

@sansmoraxz

Description

@sansmoraxz

This actually give wierd macro errors:

#[utoipa::path(
    get,
    path = "/status/{*path}",
    responses(
        (status = OK, description = "Status", body = model::MyResponse),
    )
)]
async fn my_handler(
    State(state): State<SharedState>,
    path: Option<Path<String>>,
) -> Json<model::MyResponse>

Equivalent route registration without the openapi router normally would be like this:-

use axum::Router;

let app = Router::new()
    .route("/status", get(my_handler))
    .route("/status/{*path}", get(my_handler))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions