Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the bug. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions examples/example-axum/src/todos/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ pub fn todo_routes(state: AppState) -> ApiRouter {
get_with(get_todo, get_todo_docs).delete_with(delete_todo, delete_todo_docs),
)
.api_route("/:id/complete", put_with(complete_todo, complete_todo_docs))
.api_route(
"/:id/depends-on/:depends_on_id",
put_with(depends_on_todo, depends_on_todo_docs),
)
.api_route(
"/:id/depends-on-with-struct/:depends_on_id",
put_with(depends_on_todo_struct, depends_on_todo_struct_docs),
)
.with_state(state)
}

Expand Down Expand Up @@ -90,6 +98,14 @@ struct SelectTodo {
id: Uuid,
}

#[derive(Deserialize, JsonSchema)]
struct SelectDependentTodos {
/// The ID of the Todo.
id: Uuid,
/// The ID of the Todo that this Todo depends on.
depends_on_id: Uuid,
}

async fn get_todo(
State(app): State<AppState>,
Path(todo): Path<SelectTodo>,
Expand Down Expand Up @@ -145,3 +161,27 @@ async fn complete_todo(
fn complete_todo_docs(op: TransformOperation) -> TransformOperation {
op.description("Complete a Todo.").response::<204, ()>()
}

async fn depends_on_todo(
State(_app): State<AppState>,
Path((_todo_id, _todo_depends_on_id)): Path<(Uuid, Uuid)>,
) -> impl IntoApiResponse {
todo!()
}

fn depends_on_todo_docs(op: TransformOperation) -> TransformOperation {
op.description("Todo depends on another Todo.")
.response::<204, ()>()
}

async fn depends_on_todo_struct(
State(app): State<AppState>,
Path(todos): Path<SelectDependentTodos>,
) -> impl IntoApiResponse {
todo!()
}

fn depends_on_todo_struct_docs(op: TransformOperation) -> TransformOperation {
op.description("Todo depends on another Todo.")
.response::<204, ()>()
}