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

Commit 94004ce

Browse files
committed
Rename the payload struct to appease clippy
1 parent 221f227 commit 94004ce

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+
#[serde(rename = "AddUserRequest")]
102+
pub struct Request {
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<Request>,
145147
) -> Result<Json<SingleResponse<User>>, RouteError> {
146148
if repo.user().exists(&params.username).await? {
147149
return Err(RouteError::UserAlreadyExists);

docs/api/spec.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
"content": {
170170
"application/json": {
171171
"schema": {
172-
"$ref": "#/components/schemas/AddUserParams"
172+
"$ref": "#/components/schemas/AddUserRequest"
173173
}
174174
}
175175
},
@@ -637,7 +637,8 @@
637637
}
638638
}
639639
},
640-
"AddUserParams": {
640+
"AddUserRequest": {
641+
"title": "JSON payload for the `POST /api/admin/v1/users` endpoint",
641642
"type": "object",
642643
"required": [
643644
"username"

0 commit comments

Comments
 (0)