-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update axum examples with state #1234
Comments
If I understood ur question correctly, I think u should do something like this. The main thing is to add a generic parameter to Router. |
I'm not sure if the utoipa_axum::routes! macro can handle the following scenarios: Includes middleware added to handler functions when writing routes Previous attempts to use utoipa_axum::routes! , have invariably failed By the way I would like to make a point that is not related to this issue, please don't be offended: 😄 If possible, please add a little bit more examples of generalizations; I have a basic response body based on generics, and currently only the |
I'm currently encountering the same problem as @litcc : substituting generic parameters in handlers signatures. For example, in this code, my pub struct WorkspacesController;
impl WorkspacesController {
pub fn router() -> OpenApiRouter<Deps> {
OpenApiRouter::new()
.route(
"/",
post(create_workspace_handler::<PostgresRepository>),
)
}
}
// Elsehwhere...
pub async fn create_workspace_handler<W: WorkspacesRepository>(
Extension(workspaces): Extension<W>,
) -> Result<Success, Failure> {
// Details omitted.
} Should we open a separate issue to track this? |
Could you update the axum code examples of the nested routers to include state ?
As soon as i have a handler that requires state that us nested, thw compiler infers that my router types are stateful and i can never get it to a Router<()> type later to serve it with axum.
The text was updated successfully, but these errors were encountered: