From ba9911f9a6d4aeccdd84627d97fe5daaa558c2c5 Mon Sep 17 00:00:00 2001 From: Elichai Turkel Date: Tue, 25 Jun 2024 17:09:09 +0300 Subject: [PATCH 1/2] Make Service impl over ApiRouter generic --- crates/aide/src/axum/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/aide/src/axum/mod.rs b/crates/aide/src/axum/mod.rs index ba27822..b5eafd2 100644 --- a/crates/aide/src/axum/mod.rs +++ b/crates/aide/src/axum/mod.rs @@ -178,7 +178,7 @@ use crate::{ OperationInput, OperationOutput, }; use axum::{ - body::Body, + body::{Body, HttpBody, Bytes}, handler::Handler, http::Request, response::IntoResponse, @@ -222,7 +222,9 @@ impl Clone for ApiRouter { } } -impl Service> for ApiRouter<()> { +impl Service> for ApiRouter<()> + where B: HttpBody + Send + 'static, + B::Error: Into, { type Response = axum::response::Response; type Error = Infallible; type Future = axum::routing::future::RouteFuture; @@ -232,11 +234,11 @@ impl Service> for ApiRouter<()> { &mut self, cx: &mut std::task::Context<'_>, ) -> std::task::Poll> { - >>::poll_ready(&mut self.router, cx) + Service::>::poll_ready(&mut self.router, cx) } #[inline] - fn call(&mut self, req: Request) -> Self::Future { + fn call(&mut self, req: Request) -> Self::Future { self.router.call(req) } } From 98946b274436ef82dab601f4b29b1e17b4fb4e6e Mon Sep 17 00:00:00 2001 From: Elichai Turkel Date: Tue, 25 Jun 2024 17:09:30 +0300 Subject: [PATCH 2/2] Remove use of deprecated features in indexmap --- crates/aide/src/transform.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/aide/src/transform.rs b/crates/aide/src/transform.rs index 5e97d49..a43faa3 100644 --- a/crates/aide/src/transform.rs +++ b/crates/aide/src/transform.rs @@ -838,7 +838,7 @@ impl<'t> TransformOperation<'t> { let t = callback_transform(TransformCallback::new(p)); if t.hidden { - callbacks.remove(callback_url); + callbacks.swap_remove(callback_url); if self .operation .callbacks @@ -848,7 +848,7 @@ impl<'t> TransformOperation<'t> { .unwrap() .is_empty() { - self.operation.callbacks.remove(callback_name); + self.operation.callbacks.swap_remove(callback_name); } }