Skip to content

openapi_service in utoipa_actix_web::scope::scope #1407

Closed Answered by jb-alvarado
jb-alvarado asked this question in Q&A
Discussion options

You must be logged in to vote

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)),
)

Replies: 1 comment

Comment options

You must be logged in to vote
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
Category
Q&A
Labels
None yet
1 participant