Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Commit 8b29ba3

Browse files
committed
Rename the payload struct to appease clippy
1 parent e5b59ca commit 8b29ba3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

crates/handlers/src/admin/v1/users/add.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ impl IntoResponse for RouteError {
9696
}
9797
}
9898

99+
/// # JSON payload for the `POST /api/admin/v1/users` endpoint
99100
#[derive(Deserialize, JsonSchema)]
100-
pub struct AddUserParams {
101+
#[schemars(rename = "AddUserPayload")]
102+
pub struct Payload {
101103
/// The username of the user to add.
102104
username: String,
103105

@@ -141,7 +143,7 @@ pub async fn handler(
141143
}: CallContext,
142144
NoApi(mut rng): NoApi<BoxRng>,
143145
State(homeserver): State<BoxHomeserverConnection>,
144-
Json(params): Json<AddUserParams>,
146+
Json(params): Json<Payload>,
145147
) -> Result<Json<SingleResponse<User>>, RouteError> {
146148
if repo.user().exists(&params.username).await? {
147149
return Err(RouteError::UserAlreadyExists);

docs/api.schema.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
"content": {
178178
"application/json": {
179179
"schema": {
180-
"$ref": "#/components/schemas/AddUserParams"
180+
"$ref": "#/components/schemas/AddUserPayload"
181181
}
182182
}
183183
},
@@ -661,7 +661,8 @@
661661
}
662662
}
663663
},
664-
"AddUserParams": {
664+
"AddUserPayload": {
665+
"title": "JSON payload for the `POST /api/admin/v1/users` endpoint",
665666
"type": "object",
666667
"required": [
667668
"username"

0 commit comments

Comments
 (0)