Skip to content

Commit b68719b

Browse files
committed
utoipa: Add annotations to /me/crate_owner_invitations/{crate_id} endpoints
1 parent 6dafec2 commit b68719b

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
@@ -272,7 +272,14 @@ struct OwnerInvitation {
272272
crate_owner_invite: InvitationResponse,
273273
}
274274

275-
/// Handles the `PUT /api/v1/me/crate_owner_invitations/:crate_id` route.
275+
/// Accept or decline a crate owner invitation.
276+
#[utoipa::path(
277+
put,
278+
path = "/api/v1/me/crate_owner_invitations/{crate_id}",
279+
operation_id = "handle_crate_owner_invitation",
280+
tag = "owners",
281+
responses((status = 200, description = "Successful Response")),
282+
)]
276283
pub async fn handle_invite(state: AppState, req: BytesRequest) -> AppResult<ErasedJson> {
277284
let (parts, body) = req.0.into_parts();
278285

src/router.rs

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

5859
let mut router = router
59-
.route(
60-
"/api/v1/me/crate_owner_invitations/:crate_id",
61-
put(crate_owner_invitation::handle_invite),
62-
)
6360
.route(
6461
"/api/v1/me/crate_owner_invitations/accept/:token",
6562
put(crate_owner_invitation::handle_invite_with_token),

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/{crate_id}": {
472+
"put": {
473+
"operationId": "handle_crate_owner_invitation",
474+
"responses": {
475+
"200": {
476+
"description": "Successful Response"
477+
}
478+
},
479+
"summary": "Accept or decline a crate owner invitation.",
480+
"tags": [
481+
"owners"
482+
]
483+
}
484+
},
471485
"/api/v1/me/tokens": {
472486
"get": {
473487
"operationId": "list_api_tokens",

0 commit comments

Comments
 (0)