Skip to content

Commit 6dafec2

Browse files
committed
utoipa: Add annotations to /me/crate_owner_invitations endpoints
1 parent 868d2da commit 6dafec2

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

src/controllers/crate_owner_invitation.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ use http::request::Parts;
2323
use indexmap::IndexMap;
2424
use std::collections::{HashMap, HashSet};
2525

26-
/// Handles the `GET /api/v1/me/crate_owner_invitations` route.
26+
/// List all crate owner invitations for the authenticated user.
27+
#[utoipa::path(
28+
get,
29+
path = "/api/v1/me/crate_owner_invitations",
30+
operation_id = "list_crate_owner_invitations",
31+
tag = "owners",
32+
responses((status = 200, description = "Successful Response")),
33+
)]
2734
pub async fn list(app: AppState, req: Parts) -> AppResult<ErasedJson> {
2835
let mut conn = app.db_read().await?;
2936
let auth = AuthCheck::only_cookie().check(&req, &mut conn).await?;

src/router.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,10 @@ pub fn build_axum_router(state: AppState) -> Router<()> {
5252
.routes(routes!(token::list, token::new))
5353
.routes(routes!(token::show, token::revoke))
5454
.routes(routes!(token::revoke_current))
55+
.routes(routes!(crate_owner_invitation::list))
5556
.split_for_parts();
5657

5758
let mut router = router
58-
.route(
59-
"/api/v1/me/crate_owner_invitations",
60-
get(crate_owner_invitation::list),
61-
)
6259
.route(
6360
"/api/v1/me/crate_owner_invitations/:crate_id",
6461
put(crate_owner_invitation::handle_invite),

src/snapshots/crates_io__openapi__tests__openapi_snapshot.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,20 @@ snapshot_kind: text
454454
]
455455
}
456456
},
457+
"/api/v1/me/crate_owner_invitations": {
458+
"get": {
459+
"operationId": "list_crate_owner_invitations",
460+
"responses": {
461+
"200": {
462+
"description": "Successful Response"
463+
}
464+
},
465+
"summary": "List all crate owner invitations for the authenticated user.",
466+
"tags": [
467+
"owners"
468+
]
469+
}
470+
},
457471
"/api/v1/me/tokens": {
458472
"get": {
459473
"operationId": "list_api_tokens",

0 commit comments

Comments
 (0)