Skip to content

Commit f98a886

Browse files
committed
Add OpenAPI documentation for OkResponse responses
1 parent 7652fdf commit f98a886

File tree

6 files changed

+136
-8
lines changed

6 files changed

+136
-8
lines changed

src/controllers/krate/follow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async fn follow_target(
3838
("cookie" = []),
3939
),
4040
tag = "crates",
41-
responses((status = 200, description = "Successful Response")),
41+
responses((status = 200, description = "Successful Response", body = inline(OkResponse))),
4242
)]
4343
pub async fn follow_crate(app: AppState, path: CratePath, req: Parts) -> AppResult<OkResponse> {
4444
let mut conn = app.db_write().await?;
@@ -63,7 +63,7 @@ pub async fn follow_crate(app: AppState, path: CratePath, req: Parts) -> AppResu
6363
("cookie" = []),
6464
),
6565
tag = "crates",
66-
responses((status = 200, description = "Successful Response")),
66+
responses((status = 200, description = "Successful Response", body = inline(OkResponse))),
6767
)]
6868
pub async fn unfollow_crate(app: AppState, path: CratePath, req: Parts) -> AppResult<OkResponse> {
6969
let mut conn = app.db_write().await?;

src/controllers/user/email_notifications.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub struct CrateEmailNotifications {
2828
("cookie" = []),
2929
),
3030
tag = "users",
31-
responses((status = 200, description = "Successful Response")),
31+
responses((status = 200, description = "Successful Response", body = inline(OkResponse))),
3232
)]
3333
#[deprecated]
3434
pub async fn update_email_notifications(

src/controllers/user/email_verification.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use http::request::Parts;
2121
("email_token" = String, Path, description = "Secret verification token sent to the user's email address"),
2222
),
2323
tag = "users",
24-
responses((status = 200, description = "Successful Response")),
24+
responses((status = 200, description = "Successful Response", body = inline(OkResponse))),
2525
)]
2626
pub async fn confirm_user_email(
2727
state: AppState,
@@ -53,7 +53,7 @@ pub async fn confirm_user_email(
5353
("cookie" = []),
5454
),
5555
tag = "users",
56-
responses((status = 200, description = "Successful Response")),
56+
responses((status = 200, description = "Successful Response", body = inline(OkResponse))),
5757
)]
5858
pub async fn resend_email_verification(
5959
state: AppState,

src/controllers/user/update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub struct User {
3939
("cookie" = []),
4040
),
4141
tag = "users",
42-
responses((status = 200, description = "Successful Response")),
42+
responses((status = 200, description = "Successful Response", body = inline(OkResponse))),
4343
)]
4444
pub async fn update_user(
4545
state: AppState,

src/controllers/version/yank.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use http::request::Parts;
2828
("cookie" = []),
2929
),
3030
tag = "versions",
31-
responses((status = 200, description = "Successful Response")),
31+
responses((status = 200, description = "Successful Response", body = inline(OkResponse))),
3232
)]
3333
pub async fn yank_version(
3434
app: AppState,
@@ -48,7 +48,7 @@ pub async fn yank_version(
4848
("cookie" = []),
4949
),
5050
tag = "versions",
51-
responses((status = 200, description = "Successful Response")),
51+
responses((status = 200, description = "Successful Response", body = inline(OkResponse))),
5252
)]
5353
pub async fn unyank_version(
5454
app: AppState,

src/snapshots/crates_io__openapi__tests__openapi_snapshot.snap

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,22 @@ expression: response.json()
646646
],
647647
"responses": {
648648
"200": {
649+
"content": {
650+
"application/json": {
651+
"schema": {
652+
"properties": {
653+
"ok": {
654+
"example": true,
655+
"type": "boolean"
656+
}
657+
},
658+
"required": [
659+
"ok"
660+
],
661+
"type": "object"
662+
}
663+
}
664+
},
649665
"description": "Successful Response"
650666
}
651667
},
@@ -982,6 +998,22 @@ expression: response.json()
982998
],
983999
"responses": {
9841000
"200": {
1001+
"content": {
1002+
"application/json": {
1003+
"schema": {
1004+
"properties": {
1005+
"ok": {
1006+
"example": true,
1007+
"type": "boolean"
1008+
}
1009+
},
1010+
"required": [
1011+
"ok"
1012+
],
1013+
"type": "object"
1014+
}
1015+
}
1016+
},
9851017
"description": "Successful Response"
9861018
}
9871019
},
@@ -1013,6 +1045,22 @@ expression: response.json()
10131045
],
10141046
"responses": {
10151047
"200": {
1048+
"content": {
1049+
"application/json": {
1050+
"schema": {
1051+
"properties": {
1052+
"ok": {
1053+
"example": true,
1054+
"type": "boolean"
1055+
}
1056+
},
1057+
"required": [
1058+
"ok"
1059+
],
1060+
"type": "object"
1061+
}
1062+
}
1063+
},
10161064
"description": "Successful Response"
10171065
}
10181066
},
@@ -1603,6 +1651,22 @@ expression: response.json()
16031651
],
16041652
"responses": {
16051653
"200": {
1654+
"content": {
1655+
"application/json": {
1656+
"schema": {
1657+
"properties": {
1658+
"ok": {
1659+
"example": true,
1660+
"type": "boolean"
1661+
}
1662+
},
1663+
"required": [
1664+
"ok"
1665+
],
1666+
"type": "object"
1667+
}
1668+
}
1669+
},
16061670
"description": "Successful Response"
16071671
}
16081672
},
@@ -1647,6 +1711,22 @@ expression: response.json()
16471711
],
16481712
"responses": {
16491713
"200": {
1714+
"content": {
1715+
"application/json": {
1716+
"schema": {
1717+
"properties": {
1718+
"ok": {
1719+
"example": true,
1720+
"type": "boolean"
1721+
}
1722+
},
1723+
"required": [
1724+
"ok"
1725+
],
1726+
"type": "object"
1727+
}
1728+
}
1729+
},
16501730
"description": "Successful Response"
16511731
}
16521732
},
@@ -1925,6 +2005,22 @@ expression: response.json()
19252005
"operationId": "update_email_notifications",
19262006
"responses": {
19272007
"200": {
2008+
"content": {
2009+
"application/json": {
2010+
"schema": {
2011+
"properties": {
2012+
"ok": {
2013+
"example": true,
2014+
"type": "boolean"
2015+
}
2016+
},
2017+
"required": [
2018+
"ok"
2019+
],
2020+
"type": "object"
2021+
}
2022+
}
2023+
},
19282024
"description": "Successful Response"
19292025
}
19302026
},
@@ -2156,6 +2252,22 @@ expression: response.json()
21562252
],
21572253
"responses": {
21582254
"200": {
2255+
"content": {
2256+
"application/json": {
2257+
"schema": {
2258+
"properties": {
2259+
"ok": {
2260+
"example": true,
2261+
"type": "boolean"
2262+
}
2263+
},
2264+
"required": [
2265+
"ok"
2266+
],
2267+
"type": "object"
2268+
}
2269+
}
2270+
},
21592271
"description": "Successful Response"
21602272
}
21612273
},
@@ -2275,6 +2387,22 @@ expression: response.json()
22752387
],
22762388
"responses": {
22772389
"200": {
2390+
"content": {
2391+
"application/json": {
2392+
"schema": {
2393+
"properties": {
2394+
"ok": {
2395+
"example": true,
2396+
"type": "boolean"
2397+
}
2398+
},
2399+
"required": [
2400+
"ok"
2401+
],
2402+
"type": "object"
2403+
}
2404+
}
2405+
},
22782406
"description": "Successful Response"
22792407
}
22802408
},

0 commit comments

Comments
 (0)