From 8f4de3afc03a373d4b6b8785bd59a420d89e9f0f Mon Sep 17 00:00:00 2001 From: Lauryn Menard Date: Mon, 15 May 2023 20:45:34 +0200 Subject: [PATCH] api-docs: Update create/edit scheduled message errors for IDs. In commit 38f6807af1a, we updated the `POST /scheduled_messages` endpoint to only accept user IDs for direct messages. The endpoint alread only accepted a stream ID for stream messages. But the API documentation was not updated for the errors returned when either a stream or user with the specified ID does not exist. Updates the API documentation for the correct error responses. --- zerver/openapi/zulip.yaml | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml index 0e5b9c9713..25d9d9b6aa 100644 --- a/zerver/openapi/zulip.yaml +++ b/zerver/openapi/zulip.yaml @@ -5272,21 +5272,21 @@ paths: schema: oneOf: - allOf: - - $ref: "#/components/schemas/NonExistingStreamError" + - $ref: "#/components/schemas/NonExistingStreamIdError" - description: | - A typical failed JSON response for when a stream message is sent to a stream - that does not exist: + A typical failed JSON response for when a stream message is scheduled + to be sent to a stream that does not exist: - allOf: - $ref: "#/components/schemas/CodedError" - example: { "code": "BAD_REQUEST", - "msg": "Invalid email 'eeshan@zulip.com'", + "msg": "Invalid user ID 10", "result": "error", } description: | - A typical failed JSON response for when a private message is sent to a user - that does not exist: + A typical failed JSON response for when a direct message is scheduled + to be sent to a user that does not exist: - allOf: - $ref: "#/components/schemas/JsonError" - description: | @@ -5901,7 +5901,7 @@ paths: schema: oneOf: - allOf: - - $ref: "#/components/schemas/NonExistingStreamError" + - $ref: "#/components/schemas/NonExistingStreamNameError" - description: | A typical failed JSON response for when a stream message is sent to a stream that does not exist: @@ -8655,7 +8655,7 @@ paths: application/json: schema: allOf: - - $ref: "#/components/schemas/NonExistingStreamError" + - $ref: "#/components/schemas/NonExistingStreamNameError" - description: | A typical failed JSON response for when the target stream does not exist: /users/me/subscriptions/muted_topics: @@ -18068,7 +18068,7 @@ components: "code": "BAD_REQUEST", "result": "error", } - NonExistingStreamError: + NonExistingStreamNameError: allOf: - $ref: "#/components/schemas/CodedErrorBase" - additionalProperties: false @@ -18087,6 +18087,25 @@ components: "result": "error", "stream": "nonexistent_stream", } + NonExistingStreamIdError: + allOf: + - $ref: "#/components/schemas/CodedErrorBase" + - additionalProperties: false + properties: + result: {} + msg: {} + code: {} + stream_id: + type: integer + description: | + The stream ID that could not be found. + example: + { + "code": "STREAM_DOES_NOT_EXIST", + "msg": "Stream with ID '9' does not exist", + "result": "error", + "stream_id": 9, + } AddSubscriptionsResponse: allOf: - $ref: "#/components/schemas/JsonSuccessBase"