Fix the definition of the set-password success response in the OpenAPI spec (#4003)

Fixes #3984
This commit is contained in:
Quentin Gliech
2025-02-11 14:02:05 +01:00
committed by GitHub
3 changed files with 7 additions and 10 deletions

View File

@@ -47,6 +47,10 @@ where
Templates: FromRef<S>,
UrlBuilder: FromRef<S>,
{
// We *always* want to explicitly set the possible responses, beacuse the
// infered ones are not necessarily correct
aide::generate::infer_responses(false);
aide::generate::in_context(|ctx| {
ctx.schema = schemars::gen::SchemaGenerator::new(schemars::gen::SchemaSettings::openapi3());
});

View File

@@ -74,7 +74,7 @@ pub fn doc(operation: TransformOperation) -> TransformOperation {
.id("setUserPassword")
.summary("Set the password for a user")
.tag("user")
.response_with::<200, StatusCode, _>(|t| t.description("Password was set"))
.response_with::<204, (), _>(|t| t.description("Password was set"))
.response_with::<400, RouteError, _>(|t| {
let response = ErrorResponse::from_error(&RouteError::PasswordTooWeak);
t.description("Password is too weak").example(response)

View File

@@ -906,15 +906,8 @@
"required": true
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
"204": {
"description": "Password was set"
},
"400": {
"description": "Password is too weak",