Skip to content

Commit 29ca13c

Browse files
committed
utoipa: Add annotations to /me/crate_owner_invitations/accept/{token} endpoints
1 parent b68719b commit 29ca13c

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
@@ -307,7 +307,14 @@ pub async fn handle_invite(state: AppState, req: BytesRequest) -> AppResult<Eras
307307
Ok(json!({ "crate_owner_invitation": crate_invite }))
308308
}
309309

310-
/// Handles the `PUT /api/v1/me/crate_owner_invitations/accept/:token` route.
310+
/// Accept a crate owner invitation with a token.
311+
#[utoipa::path(
312+
put,
313+
path = "/api/v1/me/crate_owner_invitations/accept/{token}",
314+
operation_id = "accept_crate_owner_invitation_with_token",
315+
tag = "owners",
316+
responses((status = 200, description = "Successful Response")),
317+
)]
311318
pub async fn handle_invite_with_token(
312319
state: AppState,
313320
Path(token): Path<String>,

src/router.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,10 @@ pub fn build_axum_router(state: AppState) -> Router<()> {
5454
.routes(routes!(token::revoke_current))
5555
.routes(routes!(crate_owner_invitation::list))
5656
.routes(routes!(crate_owner_invitation::handle_invite))
57+
.routes(routes!(crate_owner_invitation::handle_invite_with_token))
5758
.split_for_parts();
5859

5960
let mut router = router
60-
.route(
61-
"/api/v1/me/crate_owner_invitations/accept/:token",
62-
put(crate_owner_invitation::handle_invite_with_token),
63-
)
6461
.route(
6562
"/api/v1/me/email_notifications",
6663
put(user::me::update_email_notifications),

src/snapshots/crates_io__openapi__tests__openapi_snapshot.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,20 @@ snapshot_kind: text
468468
]
469469
}
470470
},
471+
"/api/v1/me/crate_owner_invitations/accept/{token}": {
472+
"put": {
473+
"operationId": "accept_crate_owner_invitation_with_token",
474+
"responses": {
475+
"200": {
476+
"description": "Successful Response"
477+
}
478+
},
479+
"summary": "Accept a crate owner invitation with a token.",
480+
"tags": [
481+
"owners"
482+
]
483+
}
484+
},
471485
"/api/v1/me/crate_owner_invitations/{crate_id}": {
472486
"put": {
473487
"operationId": "handle_crate_owner_invitation",

0 commit comments

Comments
 (0)