You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We (me and @lisasvenssonsr) have noticed a discrepancy in how url parameters are detected for the openapi specification. If we use a tuple, the arguments are auto-detected, but if we use a single parameeter, we seem to need an annotation that I think should no longer be needed because of #1224.
These endpoints work as expected:
#[utoipa::path( get, path = "/{id}", params(MyId),// This is still needed?)]asyncfnone(Path(id):Path<MyId>,) -> Result<Json<MyDTO>>{// ...}#[utoipa::path( get, path = "/{id}/with/{subid}",// No "params" needed here!)]asyncfnother(Path((id, subid)):Path<(MyId,SubId)>,) -> Result<Json<MyDTO>>{// ...}
Having a single argument and no "params" annotation, like this endpoint, also works as expected in axum, except it does not get any parameters in the openapi specification / swagger guide:
We (me and @lisasvenssonsr) have noticed a discrepancy in how url parameters are detected for the openapi specification. If we use a tuple, the arguments are auto-detected, but if we use a single parameeter, we seem to need an annotation that I think should no longer be needed because of #1224.
These endpoints work as expected:
Having a single argument and no "params" annotation, like this endpoint, also works as expected in axum, except it does not get any parameters in the openapi specification / swagger guide:
As a workaround, it seems wrapping the parameter in a single-value tuple is enogh to get it to work:
Are we missing anything? Should there be another trait implemented for
MyId
that is somehow implemented for the tuple? Or is this a bug in utoipa?Versions used
According to our Cargo.toml:
The text was updated successfully, but these errors were encountered: