diff --git a/utoipa-actix-web/CHANGELOG.md b/utoipa-actix-web/CHANGELOG.md index d1d6f8a4..2572d68e 100644 --- a/utoipa-actix-web/CHANGELOG.md +++ b/utoipa-actix-web/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog - utoipa-actix-web +## 0.1.2 - Nov 8 2024 + +### Added + +* Add passthrough for `Scope::wrap` (https://github.com/juhaku/utoipa/pull/1196) + ## 0.1.1 - Oct 30 2024 ### Changed diff --git a/utoipa-actix-web/Cargo.toml b/utoipa-actix-web/Cargo.toml index c23e0ab0..5d2055e5 100644 --- a/utoipa-actix-web/Cargo.toml +++ b/utoipa-actix-web/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "utoipa-actix-web" description = "Utoipa's actix-web bindings for seamless integration of the two" -version = "0.1.1" +version = "0.1.2" edition = "2021" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/utoipa-actix-web/src/scope.rs b/utoipa-actix-web/src/scope.rs index 9cff8c4e..8e23baf0 100644 --- a/utoipa-actix-web/src/scope.rs +++ b/utoipa-actix-web/src/scope.rs @@ -5,7 +5,7 @@ use core::fmt; use std::cell::{Cell, RefCell}; -use actix_service::{IntoServiceFactory, ServiceFactory}; +use actix_service::{IntoServiceFactory, ServiceFactory, Transform}; use actix_web::body::MessageBody; use actix_web::dev::{AppService, HttpServiceFactory, ServiceRequest, ServiceResponse}; use actix_web::guard::Guard; @@ -97,6 +97,33 @@ where Self(self.0.app_data(data), self.1, self.2) } + /// Passthrough implementation for [`actix_web::Scope::wrap`]. + pub fn wrap( + self, + middleware: M, + ) -> Scope< + impl ServiceFactory< + ServiceRequest, + Config = (), + Response = ServiceResponse, + Error = Error, + InitError = (), + >, + > + where + M: Transform< + T::Service, + ServiceRequest, + Response = ServiceResponse, + Error = Error, + InitError = (), + > + 'static, + B: MessageBody, + { + let scope = self.0.wrap(middleware); + Scope(scope, self.1, self.2) + } + /// Synonymous for [`UtoipaApp::configure`][utoipa_app_configure] /// /// [utoipa_app_configure]: ../struct.UtoipaApp.html#method.configure