Skip to content

Commit

Permalink
Update Redoc endpoint to axum 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Libbum committed Nov 27, 2023
1 parent 89a5ece commit 2c86a4d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion utoipa-redoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ serde_json = { version = "1.0" }
utoipa = { version = "4", path = "../utoipa" }
actix-web = { version = "4", optional = true, default-features = false }
rocket = { version = "0.5.0-rc.3", features = ["json"], optional = true }
axum = { version = "0.6", optional = true }
axum = { version = "0.7", optional = true }
6 changes: 2 additions & 4 deletions utoipa-redoc/src/axum.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
#![cfg(feature = "axum")]

use axum::body::HttpBody;
use axum::response::Html;
use axum::{routing, Router};

use crate::{Redoc, Spec};

impl<'s, 'u, S: Spec, R, B> From<Redoc<'s, 'u, S>> for Router<R, B>
impl<'s, 'u, S: Spec, R> From<Redoc<'s, 'u, S>> for Router<R>
where
R: Clone + Send + Sync + 'static,
B: HttpBody + Send + 'static,
's: 'static,
{
fn from(value: Redoc<'s, 'u, S>) -> Self {
let html = value.to_html();
Router::<R, B>::new().route(value.url, routing::get(move || async { Html(html) }))
Router::<R>::new().route(value.url, routing::get(move || async { Html(html) }))
}
}

0 comments on commit 2c86a4d

Please sign in to comment.