Fix the definition of the set-password success response in the OpenAPI spec (#4003)
Fixes #3984
This commit is contained in:
@@ -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());
|
||||
});
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user