add redoc to see how it works

This commit is contained in:
Tamo 2024-10-14 11:30:10 +02:00
parent 4fbcf6ae6f
commit f958399275
3 changed files with 21 additions and 1 deletions

16
Cargo.lock generated
View File

@ -71,6 +71,7 @@ dependencies = [
"tokio", "tokio",
"tokio-util", "tokio-util",
"tracing", "tracing",
"zstd",
] ]
[[package]] [[package]]
@ -92,6 +93,7 @@ dependencies = [
"bytestring", "bytestring",
"cfg-if", "cfg-if",
"http 0.2.11", "http 0.2.11",
"regex",
"regex-lite", "regex-lite",
"serde", "serde",
"tracing", "tracing",
@ -197,6 +199,7 @@ dependencies = [
"mime", "mime",
"once_cell", "once_cell",
"pin-project-lite", "pin-project-lite",
"regex",
"regex-lite", "regex-lite",
"serde", "serde",
"serde_json", "serde_json",
@ -3457,6 +3460,7 @@ dependencies = [
"urlencoding", "urlencoding",
"utoipa", "utoipa",
"utoipa-rapidoc", "utoipa-rapidoc",
"utoipa-redoc",
"utoipa-scalar", "utoipa-scalar",
"uuid", "uuid",
"wiremock", "wiremock",
@ -5883,6 +5887,18 @@ dependencies = [
"utoipa", "utoipa",
] ]
[[package]]
name = "utoipa-redoc"
version = "4.0.1-rc.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4375bb6b0cb78a240c973f5e99977c482f3e92aeea1907367caa28776b9aaf9"
dependencies = [
"actix-web",
"serde",
"serde_json",
"utoipa",
]
[[package]] [[package]]
name = "utoipa-scalar" name = "utoipa-scalar"
version = "0.2.0-rc.0" version = "0.2.0-rc.0"

View File

@ -107,6 +107,7 @@ roaring = "0.10.2"
utoipa = { version = "5.0.0-rc.0", features = ["actix_extras", "macros", "non_strict_integers", "preserve_order", "uuid", "time", "openapi_extensions"] } utoipa = { version = "5.0.0-rc.0", features = ["actix_extras", "macros", "non_strict_integers", "preserve_order", "uuid", "time", "openapi_extensions"] }
utoipa-scalar = { version = "0.2.0-rc.0", features = ["actix-web"] } utoipa-scalar = { version = "0.2.0-rc.0", features = ["actix-web"] }
utoipa-rapidoc = { version = "4.0.1-rc.0", features = ["actix-web"] } utoipa-rapidoc = { version = "4.0.1-rc.0", features = ["actix-web"] }
utoipa-redoc = { version = "4.0.1-rc.0", features = ["actix-web"] }
[dev-dependencies] [dev-dependencies]
actix-rt = "2.10.0" actix-rt = "2.10.0"

View File

@ -26,6 +26,8 @@ use tracing::debug;
use utoipa::OpenApi; use utoipa::OpenApi;
use utoipa::ToSchema; use utoipa::ToSchema;
use utoipa_rapidoc::RapiDoc; use utoipa_rapidoc::RapiDoc;
use utoipa_redoc::Redoc;
use utoipa_redoc::Servable;
use utoipa_scalar::{Scalar, Servable as ScalarServable}; use utoipa_scalar::{Scalar, Servable as ScalarServable};
use self::api_key::KeyView; use self::api_key::KeyView;
@ -71,7 +73,8 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
cfg.service(web::scope("/tasks").configure(tasks::configure)) // done cfg.service(web::scope("/tasks").configure(tasks::configure)) // done
.service(Scalar::with_url("/scalar", openapi.clone())) // done .service(Scalar::with_url("/scalar", openapi.clone())) // done
.service(RapiDoc::with_openapi("/api-docs/openapi.json", openapi).path("/rapidoc")) // done .service(RapiDoc::with_openapi("/api-docs/openapi.json", openapi.clone()).path("/rapidoc")) // done
.service(Redoc::with_url("/redoc", openapi))
.service(web::resource("/health").route(web::get().to(get_health))) // done .service(web::resource("/health").route(web::get().to(get_health))) // done
.service(web::scope("/logs").configure(logs::configure)) // done .service(web::scope("/logs").configure(logs::configure)) // done
.service(web::scope("/keys").configure(api_key::configure)) .service(web::scope("/keys").configure(api_key::configure))