mirror of https://github.com/zulip/zulip.git
api-docs: Correct error documentation for api/deactivate-own-user.
In commit 3e369bcf9
, the `code` field for api/deactivate-own-user
was incorrectly documented as "BAD_REQUEST", which is the code for
the similar error returned by api/deactivate-user.
Corrects the error code to be "CANNOT_DEACTIVATE_LAST_USER" and
adds documentation for the two other fields returned by this
error response.
Note that the descriptions for the fields are added in the error
response schema will not be rendered in our current documentation.
They are rendered in other third-party tools and are therefore
good to have in our OpenAPI documentation. The description that
will be rendered in our documentation is the general error response
schema description and that is also updated for details about the
extra fields in this error response.
This commit is contained in:
parent
54ac09174b
commit
5774486c12
|
@ -8075,7 +8075,7 @@ paths:
|
|||
summary: Deactivate own user
|
||||
tags: ["users"]
|
||||
description: |
|
||||
Deactivates the user's account. See also the administrative endpoint for
|
||||
Deactivates the current user's account. See also the administrative endpoint for
|
||||
[deactivating another user](/api/deactivate-user).
|
||||
|
||||
This endpoint is primarily useful to Zulip clients providing a user settings UI.
|
||||
|
@ -8088,16 +8088,45 @@ paths:
|
|||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/CodedError"
|
||||
- example:
|
||||
- $ref: "#/components/schemas/CodedErrorBase"
|
||||
- additionalProperties: false
|
||||
properties:
|
||||
result: {}
|
||||
msg: {}
|
||||
code: {}
|
||||
entity:
|
||||
type: string
|
||||
description: |
|
||||
An internationalized string that notes if the current user is the only
|
||||
organization owner or the only user in the organization.
|
||||
is_last_owner:
|
||||
type: boolean
|
||||
description: |
|
||||
Whether the current user is the only organization owner (meaning there
|
||||
are other active users in the organization) or the only active user in the
|
||||
organzation.
|
||||
required:
|
||||
- entity
|
||||
- is_last_owner
|
||||
example:
|
||||
{
|
||||
"code": "BAD_REQUEST",
|
||||
"code": "CANNOT_DEACTIVATE_LAST_USER",
|
||||
"msg": "Cannot deactivate the only organization owner",
|
||||
"result": "error",
|
||||
"entity": "organization owner",
|
||||
"is_last_owner": true,
|
||||
}
|
||||
description: |
|
||||
An example JSON error response when attempting to deactivate the only
|
||||
organization owner in an organization:
|
||||
If the current user is the only organization owner or only user in the
|
||||
organization, their account cannot be deactivated and an error response
|
||||
will be returned. The `is_last_owner` field in the error response
|
||||
indicates whether the user is the only owner (`true`) or the only user
|
||||
(`false`). The `entity` field in the error response is a internationalized
|
||||
string that notes if the current user is the only organization owner or
|
||||
the only user.
|
||||
|
||||
An example JSON error response when the current user is the only
|
||||
organization owner in the organization:
|
||||
/users/me/alert_words:
|
||||
get:
|
||||
operationId: get-alert-words
|
||||
|
|
Loading…
Reference in New Issue