juhaku / utoipa

Simple, Fast, Code first and Compile time generated OpenAPI documentation for Rust
Apache License 2.0
2.48k stars 197 forks source link

Added a passthrough for scoped middleware in actix-web #1196

Closed nico-incubiq closed 2 weeks ago

nico-incubiq commented 2 weeks ago

This PR adds the ability to register middlewares at a specific Scope using a fluent API, similar to the one of actix-web's Scope struct.

Before:

utoipa_actix_web::scope(
    actix_web::web::scope("/admin")
        .wrap(Authenticated::new("/admin"))
    )
    .service(admin_dashboard)

After:

utoipa_actix_web::scope("/admin")
    .wrap(Authenticated::new("/admin"))
    .service(admin_dashboard)
nico-incubiq commented 2 weeks ago

Thanks :) brilliant project btw!