Given an endpoint annotated with utoipa::path and the method including both Path() and Query() extractors, utoipa-axum will correctly infer the path parameter, with the name provided in the "path" element, but not the query parameters, requiring you to manually define the params attribute in the macro. If you then define only the query params, they will appear above path.
In the example below, I expected to not have to include the params() argument in the macro and for utoipa-axum to automatically infer all params from the arguments of the function. If you remove that, the endpoint will only show the path parameter named "id" (following the path name, not the variable name in the method, which is expected)
#[derive(Debug, Deserialize, IntoParams)]
#[serde(rename_all = "camelCase")]
#[into_params(parameter_in = Query)]
struct MyQuery {
foo: String,
}
#[utoipa::path(
get,
path = "/users/{id}",
params(
("id" = i32, Path),
MyQuery
)
)]
async fn get_user(
Path(user_id): Path<i32>,
Query(query): Query<MyQuery>
) -> Response {}
Given an endpoint annotated with utoipa::path and the method including both Path() and Query() extractors, utoipa-axum will correctly infer the path parameter, with the name provided in the "path" element, but not the query parameters, requiring you to manually define the
paramsattribute in the macro. If you then define only the query params, they will appear above path.In the example below, I expected to not have to include the params() argument in the macro and for utoipa-axum to automatically infer all params from the arguments of the function. If you remove that, the endpoint will only show the path parameter named "id" (following the path name, not the variable name in the method, which is expected)