-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
130 additions
and
65 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
mod doc; | ||
mod error; | ||
mod extractor; | ||
mod init; | ||
mod models; | ||
mod routers; | ||
mod validation; | ||
|
||
pub mod models; | ||
pub mod routers; | ||
|
||
pub use init::{setup_config, setup_db, setup_router}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "doc" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] | ||
axum = { workspace = true } | ||
utoipa = { workspace = true, features = ["axum_extras"] } | ||
utoipa-swagger-ui = { version = "7.1.1-alpha.0", features = [ | ||
"axum", | ||
"vendored", | ||
], default-features = false } | ||
utoipa-scalar = { version = "0.2.0-alpha.0", features = [ | ||
"axum", | ||
], default-features = false } | ||
|
||
api = { path = "../api" } | ||
models = { path = "../models" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use axum::Router; | ||
use utoipa::OpenApi; | ||
use utoipa_scalar::{Scalar, Servable as ScalarServable}; | ||
use utoipa_swagger_ui::SwaggerUi; | ||
|
||
mod root; | ||
mod user; | ||
|
||
#[derive(OpenApi)] | ||
#[openapi( | ||
nest( | ||
(path = "/", api = root::RootApi), | ||
(path = "/users", api = user::UserApi), | ||
), | ||
tags( | ||
(name = "root", description = "Root API"), | ||
(name = "user", description = "User API") | ||
) | ||
)] | ||
struct _ApiDoc; | ||
|
||
pub trait ApiDoc { | ||
fn attach_doc(self) -> Self; | ||
} | ||
|
||
impl ApiDoc for Router { | ||
fn attach_doc(self) -> Self { | ||
self.merge(SwaggerUi::new("/docs").url("/openapi.json", _ApiDoc::openapi())) | ||
.merge(Scalar::with_url("/scalar", _ApiDoc::openapi())) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
use utoipa::OpenApi; | ||
|
||
use crate::routers::root::*; | ||
use api::routers::root::*; | ||
|
||
#[derive(OpenApi)] | ||
#[openapi(paths(root))] | ||
pub struct RootApi; | ||
pub(super) struct RootApi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters