openapi_service in utoipa_actix_web::scope::scope #1407
-
Hello, I though I could so something like: App::new()
.into_utoipa_app()
.openapi(ApiDoc::openapi())
.service(
scope::scope("/api/v2").wrap(auth)
.service(get_media)
.service(get_info)
)
.service(
scope::scope("/doc")
.wrap(HttpAuthentication::basic(basic_auth))
.openapi_service(|api| {
SwaggerUi::new("/swagger-ui/{_:.*}").url("/api-docs/openapi.json", api)
}),
)
.into_app() But sadly openapi_service is no part of scop. Is there any other way to add a custom auth middleware? |
Beta Was this translation helpful? Give feedback.
Answered by
jb-alvarado
Jun 3, 2025
Replies: 1 comment
-
Ok, I found a solution. let (app, api) = App::new()
.into_utoipa_app()
.openapi(ApiDoc::openapi())
.service(
scope::scope("/api/v2").wrap(auth)
.service(get_media)
.service(get_info)
)
.split_for_parts();
app.service(
web::scope("/doc")
.wrap(HttpAuthentication::basic(basic_auth))
.service(SwaggerUi::new("/swagger-ui/{_:.*}").url("/api-docs/openapi.json", api)),
) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jb-alvarado
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok, I found a solution.