Skip to content

Commit 2e8e845

Browse files
authored
Fix the definition of the set-password success response in the OpenAPI spec (#4003)
Fixes #3984
2 parents 54e3125 + c881fb2 commit 2e8e845

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

crates/handlers/src/admin/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ where
4747
Templates: FromRef<S>,
4848
UrlBuilder: FromRef<S>,
4949
{
50+
// We *always* want to explicitly set the possible responses, beacuse the
51+
// infered ones are not necessarily correct
52+
aide::generate::infer_responses(false);
53+
5054
aide::generate::in_context(|ctx| {
5155
ctx.schema = schemars::gen::SchemaGenerator::new(schemars::gen::SchemaSettings::openapi3());
5256
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn doc(operation: TransformOperation) -> TransformOperation {
7474
.id("setUserPassword")
7575
.summary("Set the password for a user")
7676
.tag("user")
77-
.response_with::<200, StatusCode, _>(|t| t.description("Password was set"))
77+
.response_with::<204, (), _>(|t| t.description("Password was set"))
7878
.response_with::<400, RouteError, _>(|t| {
7979
let response = ErrorResponse::from_error(&RouteError::PasswordTooWeak);
8080
t.description("Password is too weak").example(response)

docs/api/spec.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -906,15 +906,8 @@
906906
"required": true
907907
},
908908
"responses": {
909-
"200": {
910-
"description": "",
911-
"content": {
912-
"application/json": {
913-
"schema": {
914-
"$ref": "#/components/schemas/ErrorResponse"
915-
}
916-
}
917-
}
909+
"204": {
910+
"description": "Password was set"
918911
},
919912
"400": {
920913
"description": "Password is too weak",

0 commit comments

Comments
 (0)