From 9c3341ad950d8de05ae6c5d24ca94e21554a054a Mon Sep 17 00:00:00 2001 From: sahil839 Date: Sat, 22 Aug 2020 00:41:38 +0530 Subject: [PATCH] openapi: Rearrange users/{user_id}/subscriptions/{stream_id} docs. This commit moves docs for users/{user_id}/subscriptions/{stream_id} enndpoint to be after users/me/subscriptions/muted_topics docs. We are rearranging the docs because after adding the new patch endpoint for users/{user_id}/subscriptions/{stream_id}, openapi_core validator tries to match 'users/me/subscriptions/muted_topics' with 'users/{user_id}/subscriptions/{stream_id}' path in zulip.yaml and thus gives error while running tests. This is a bug in 'openapi_core' as it does not follows OpenAPI specs to match concrete paths before their templated counterparts. Thus, this commit rearranges the docs such that openapi_core validator tries to match muted_topics endpoint with the correct path in zulip.yaml docs. --- zerver/openapi/zulip.yaml | 56 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml index 9f6eeaa679..ab9b0738bf 100644 --- a/zerver/openapi/zulip.yaml +++ b/zerver/openapi/zulip.yaml @@ -4966,34 +4966,6 @@ paths: application/json: schema: $ref: "#/components/schemas/NonExistingStreamError" - /users/{user_id}/subscriptions/{stream_id}: - get: - operationId: get_subscription_status - tags: ["streams"] - description: | - Check whether a user is subscribed to a stream. - - `GET {{ api_url }}/v1/users/{user_id}/subscriptions/{stream_id}` - - **Changes**: New in Zulip 3.0 (feature level 11). - parameters: - - $ref: "#/components/parameters/UserId" - - $ref: "#/components/parameters/StreamIdInPath" - responses: - "200": - description: Success - content: - application/json: - schema: - allOf: - - $ref: "#/components/schemas/JsonSuccess" - - properties: - is_subscribed: - type: boolean - description: | - Whether the user is subscribed to the stream. - - example: - {"msg": "", "result": "success", "is_subscribed": false} /users/me/subscriptions/muted_topics: patch: operationId: mute_topic @@ -5063,6 +5035,34 @@ paths: - $ref: "#/components/schemas/JsonError" - example: {"msg": "Topic is not muted", "result": "error"} + /users/{user_id}/subscriptions/{stream_id}: + get: + operationId: get_subscription_status + tags: ["streams"] + description: | + Check whether a user is subscribed to a stream. + + `GET {{ api_url }}/v1/users/{user_id}/subscriptions/{stream_id}` + + **Changes**: New in Zulip 3.0 (feature level 11). + parameters: + - $ref: "#/components/parameters/UserId" + - $ref: "#/components/parameters/StreamIdInPath" + responses: + "200": + description: Success + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/JsonSuccess" + - properties: + is_subscribed: + type: boolean + description: | + Whether the user is subscribed to the stream. + - example: + {"msg": "", "result": "success", "is_subscribed": false} /realm/emoji/{emoji_name}: post: operationId: upload_custom_emoji