Skip to content

Commit dd4f192

Browse files
committed
utoipa: Add annotations to /me/updates endpoints
1 parent 67d13f7 commit dd4f192

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

src/controllers/user/me.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,14 @@ pub async fn me(app: AppState, req: Parts) -> AppResult<Json<EncodableMe>> {
6969
}))
7070
}
7171

72-
/// Handles the `GET /me/updates` route.
72+
/// List versions of crates that the authenticated user follows.
73+
#[utoipa::path(
74+
get,
75+
path = "/api/v1/me/updates",
76+
operation_id = "get_authenticated_user_updates",
77+
tag = "versions",
78+
responses((status = 200, description = "Successful Response")),
79+
)]
7380
pub async fn updates(app: AppState, req: Parts) -> AppResult<ErasedJson> {
7481
let mut conn = app.db_read_prefer_primary().await?;
7582
let auth = AuthCheck::only_cookie().check(&req, &mut conn).await?;

src/router.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ pub fn build_axum_router(state: AppState) -> Router<()> {
4848
.routes(routes!(user::other::stats))
4949
.routes(routes!(team::show_team))
5050
.routes(routes!(user::me::me))
51+
.routes(routes!(user::me::updates))
5152
.split_for_parts();
5253

5354
let mut router = router
54-
.route("/api/v1/me/updates", get(user::me::updates))
5555
.route("/api/v1/me/tokens", get(token::list).put(token::new))
5656
.route(
5757
"/api/v1/me/tokens/:id",

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/updates": {
458+
"get": {
459+
"operationId": "get_authenticated_user_updates",
460+
"responses": {
461+
"200": {
462+
"description": "Successful Response"
463+
}
464+
},
465+
"summary": "List versions of crates that the authenticated user follows.",
466+
"tags": [
467+
"versions"
468+
]
469+
}
470+
},
457471
"/api/v1/teams/{team}": {
458472
"get": {
459473
"operationId": "get_team",

0 commit comments

Comments
 (0)