Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

api-docs: Add shared InvalidStreamError schema.

Lauryn Menardc4d4dfda4d14
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index b54f01365b7..5046ff26843 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -5640,14 +5640,8 @@ paths:
schema:
oneOf:
- allOf:
- - $ref: "#/components/schemas/CodedError"
- - example:
- {
- "code": "BAD_REQUEST",
- "msg": "Invalid stream ID",
- "result": "error",
- }
- description: |
+ - $ref: "#/components/schemas/InvalidStreamError"
+ - description: |
A typical failed JSON response for when an invalid stream ID is passed:
- allOf:
- $ref: "#/components/schemas/CodedError"
@@ -5688,15 +5682,9 @@ paths:
application/json:
schema:
allOf:
- - $ref: "#/components/schemas/CodedError"
+ - $ref: "#/components/schemas/InvalidStreamError"
- description: |
A typical failed JSON response for when an invalid stream ID is passed:
- example:
- {
- "code": "BAD_REQUEST",
- "msg": "Invalid stream ID",
- "result": "error",
- }
/messages:
get:
operationId: get-messages
@@ -8484,14 +8472,8 @@ paths:
application/json:
schema:
allOf:
- - $ref: "#/components/schemas/JsonError"
- - example:
- {
- "code": "BAD_REQUEST",
- "msg": "Invalid stream ID",
- "result": "error",
- }
- description: |
+ - $ref: "#/components/schemas/InvalidStreamError"
+ - description: |
An example JSON response for when the user is attempting to fetch the topics
of a non-existing stream (or also a private stream they don't have access to):
/users/me/subscriptions:
@@ -15799,14 +15781,8 @@ paths:
application/json:
schema:
allOf:
- - $ref: "#/components/schemas/JsonError"
- - example:
- {
- "code": "BAD_REQUEST",
- "msg": "Invalid stream ID",
- "result": "error",
- }
- description: |
+ - $ref: "#/components/schemas/InvalidStreamError"
+ - description: |
An example JSON response for when the requested stream does not exist,
or where the user does not have permission to access the target stream:
/streams:
@@ -16070,15 +16046,9 @@ paths:
application/json:
schema:
allOf:
- - $ref: "#/components/schemas/CodedError"
- - example:
- {
- "code": "BAD_REQUEST",
- "msg": "Invalid stream ID",
- "result": "error",
- }
- description: |
- An example JSON response for when the stream ID is not valid.
+ - $ref: "#/components/schemas/InvalidStreamError"
+ - description: |
+ An example JSON response for when the stream ID is not valid:
delete:
operationId: archive-stream
summary: Archive a stream
@@ -16097,14 +16067,8 @@ paths:
application/json:
schema:
allOf:
- - $ref: "#/components/schemas/JsonError"
- - example:
- {
- "code": "BAD_REQUEST",
- "msg": "Invalid stream ID",
- "result": "error",
- }
- description: |
+ - $ref: "#/components/schemas/InvalidStreamError"
+ - description: |
An example JSON response for when the supplied stream does not exist:
patch:
operationId: update-stream
@@ -16251,14 +16215,8 @@ paths:
schema:
oneOf:
- allOf:
- - $ref: "#/components/schemas/JsonError"
- - example:
- {
- "code": "BAD_REQUEST",
- "msg": "Invalid stream ID",
- "result": "error",
- }
- description: |
+ - $ref: "#/components/schemas/InvalidStreamError"
+ - description: |
An example JSON response for when the supplied stream does not exist:
- allOf:
- $ref: "#/components/schemas/JsonError"
@@ -19163,6 +19121,20 @@ components:
"code": "BAD_REQUEST",
"result": "error",
}
+ InvalidStreamError:
+ allOf:
+ - $ref: "#/components/schemas/CodedErrorBase"
+ - additionalProperties: false
+ properties:
+ result: {}
+ msg: {}
+ code: {}
+ example:
+ {
+ "msg": "Invalid stream ID",
+ "code": "BAD_REQUEST",
+ "result": "error",
+ }
NonExistingStreamNameError:
allOf:
- $ref: "#/components/schemas/CodedErrorBase"