apidocs: Fix response in API templates.

Now, the descriptions and all subschemas
are directly returned just by
`generate_code_example`, and so, these individual
subschemas and descriptions can be removed from the
templates.

All API endpoints docs are exactly the same after the
change, except few where missing 400 responses got added
due to the modification
This commit is contained in:
Suyash Vardhan Mathur 2021-06-08 02:23:29 +05:30 committed by Tim Abbott
parent 6692250858
commit 1fa82c2fcd
62 changed files with 80 additions and 239 deletions

View File

@ -27,6 +27,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/realm/playgrounds:post|fixture(200)}
{generate_code_example|/realm/playgrounds:post|fixture(400)}

View File

@ -27,6 +27,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/realm/filters:post|fixture(200)}
{generate_code_example|/realm/filters:post|fixture(400)}

View File

@ -24,6 +24,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/messages/{message_id}/reactions:post|fixture(200)}
{generate_code_example|/messages/{message_id}/reactions:post|fixture(400)}

View File

@ -25,10 +25,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/streams/{stream_id}:delete|fixture(200)}
An example JSON response for when the supplied stream does not exist:
{generate_code_example|/streams/{stream_id}:delete|fixture(400)}

View File

@ -27,6 +27,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/messages/matches_narrow:get|fixture(200)}
{generate_code_example|/messages/matches_narrow:get|fixture(400)}

View File

@ -27,6 +27,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/realm/profile_fields:post|fixture(200)}
{generate_code_example|/realm/profile_fields:post|fixture(400)}

View File

@ -23,10 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/user_groups/create:post|fixture(200)}
An example JSON error response for when the one of the users does not exist:
{generate_code_example|/user_groups/create:post|fixture(400)}

View File

@ -33,11 +33,6 @@ More examples and documentation can be found [here](https://github.com/zulip/zul
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users:post|fixture(200)}
A typical JSON response for when another user with the same
email address already exists in the realm:
{generate_code_example|/users:post|fixture(400)}

View File

@ -23,11 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/me:delete|fixture(200)}
An example JSON error response when attempting to deactivate the only
organization owner in an organization:
{generate_code_example|/users/me:delete|fixture(400)}

View File

@ -23,11 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/{user_id}:delete|fixture(200)}
An example JSON error response when attempting to deactivate the only
organization owner in an organization:
{generate_code_example|/users/{user_id}:delete|fixture(400)}

View File

@ -25,15 +25,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/messages/{message_id}:delete|fixture(200)}
An example JSON response for when the specified message does not exist:
{generate_code_example|/messages/{message_id}:delete|fixture(400_0)}
An example JSON response for when the user making the query does not
have permission to delete the message:
{generate_code_example|/messages/{message_id}:delete|fixture(400_1)}
{generate_code_example|/messages/{message_id}:delete|fixture(400)}

View File

@ -29,11 +29,6 @@ More examples and documentation can be found [here](https://github.com/zulip/zul
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/events:delete|fixture(200)}
A typical JSON response for when the `queue_id` is non-existent or the
associated queue has already been deleted:
{generate_code_example|/events:delete|fixture(400)}

View File

@ -23,6 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/dev_fetch_api_key:post|fixture(200)}
{generate_code_example|/dev_fetch_api_key:post|fixture(400)}

View File

@ -23,6 +23,4 @@
### Example response
A typical successful JSON response may look like:
{generate_code_example|/fetch_api_key:post|fixture(200)}

View File

@ -27,6 +27,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/attachments:get|fixture(200)}
{generate_code_example|/attachments:get|fixture(400)}

View File

@ -34,6 +34,6 @@ More examples and documentation can be found [here](https://github.com/zulip/zul
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/realm/emoji:get|fixture(200)}
{generate_code_example|/realm/emoji:get|fixture(400)}

View File

@ -28,6 +28,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/realm/profile_fields:get|fixture(200)}
{generate_code_example|/realm/profile_fields:get|fixture(400)}

View File

@ -58,15 +58,10 @@ endpoint and a queue would be registered in the absence of a `queue_id`.
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/events:get|fixture(200)}
#### BAD_EVENT_QUEUE_ID errors
If the target event queue has been garbage collected, you'll get the
following error response:
{generate_code_example|/events:get|fixture(400)}
A compliant client will handle this error by re-initializing itself

View File

@ -27,6 +27,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/realm/linkifiers:get|fixture(200)}
{generate_code_example|/realm/linkifiers:get|fixture(400)}

View File

@ -37,10 +37,6 @@ was edited, `prev_content`, `prev_rendered_content`, and
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/messages/{message_id}/history:get|fixture(200)}
An example JSON response for when the specified message does not exist:
{generate_code_example|/messages/{message_id}/history:get|fixture(400)}

View File

@ -37,10 +37,6 @@ present in all Zulip API responses).
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/messages:get|fixture(200)}
[status-messages]: /help/format-your-message-using-markdown#status-messages
[linkifiers]: /help/add-a-custom-linkifier
[message-flags]: /api/update-message-flags#available-flags
{generate_code_example|/messages:get|fixture(400)}

View File

@ -33,6 +33,6 @@ This endpoint takes no parameters.
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/me:get|fixture(200)}
{generate_code_example|/users/me:get|fixture(400)}

View File

@ -27,12 +27,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/messages/{message_id}:get|fixture(200)}
An example JSON response for when the specified message does not exist or it
is not visible to the user making the query (e.g. it was a PM between other
two users):
{generate_code_example|/messages/{message_id}:get|fixture(400)}

View File

@ -39,6 +39,6 @@ response, for two reasons:
#### Example response
A typical successful JSON response for a single-organization server may look like:
{generate_code_example|/server_settings:get|fixture(200)}
{generate_code_example|/server_settings:get|fixture(400)}

View File

@ -35,10 +35,6 @@ More examples and documentation can be found [here](https://github.com/zulip/zul
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/get_stream_id:get|fixture(200)}
An example JSON response for when the supplied stream does not exist:
{generate_code_example|/get_stream_id:get|fixture(400)}

View File

@ -33,11 +33,6 @@ More examples and documentation can be found [here](https://github.com/zulip/zul
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/me/{stream_id}/topics:get|fixture(200)}
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):
{generate_code_example|/users/me/{stream_id}/topics:get|fixture(400)}

View File

@ -40,12 +40,6 @@ as URL query parameters, like so:
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/streams:get|fixture(200)}
An example JSON response for when the user is not authorized to use the
`include_all_active` parameter (i.e. because they are not an organization
administrator):
{generate_code_example|/streams:get|fixture(400)}

View File

@ -23,6 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/{user_id}/subscriptions/{stream_id}:get|fixture(200)}
{generate_code_example|/users/{user_id}/subscriptions/{stream_id}:get|fixture(400)}

View File

@ -37,6 +37,6 @@ You may pass the `include_subscribers` query parameter as follows:
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/me/subscriptions:get|fixture(200)}
{generate_code_example|/users/me/subscriptions:get|fixture(400)}

View File

@ -33,6 +33,6 @@ You may pass the `client_gravatar` or `include_custom_profile_fields` query para
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/{email}:get|fixture(200)}
{generate_code_example|/users/{email}:get|fixture(400)}

View File

@ -29,6 +29,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/user_groups:get|fixture(200)}
{generate_code_example|/user_groups:get|fixture(400)}

View File

@ -27,6 +27,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/{user_id_or_email}/presence:get|fixture(200)}
{generate_code_example|/users/{user_id_or_email}/presence:get|fixture(400)}

View File

@ -33,6 +33,6 @@ You may pass the `client_gravatar` or `include_custom_profile_fields` query para
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/{user_id}:get|fixture(200)}
{generate_code_example|/users/{user_id}:get|fixture(400)}

View File

@ -39,6 +39,6 @@ You may pass the `client_gravatar` query parameter as follows:
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users:get|fixture(200)}
{generate_code_example|/users:get|fixture(400)}

View File

@ -23,10 +23,9 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/mark_all_as_read:post|fixture(200)}
{generate_code_example|/mark_all_as_read:post|fixture(400)}
{generate_api_title(/mark_stream_as_read:post)}
@ -55,10 +54,9 @@ A typical successful JSON response may look like:
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/mark_stream_as_read:post|fixture(200)}
{generate_code_example|/mark_stream_as_read:post|fixture(400)}
# Mark messages in a topic as read
{generate_api_title(/mark_topic_as_read:post)}
@ -88,6 +86,6 @@ A typical successful JSON response may look like:
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/mark_topic_as_read:post|fixture(200)}
{generate_code_example|/mark_topic_as_read:post|fixture(400)}

View File

@ -23,17 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/me/subscriptions/muted_topics:patch|fixture(200)}
An example JSON response for when an `add` operation is requested for a topic
that has already been muted:
{generate_code_example|/users/me/subscriptions/muted_topics:patch|fixture(400_0)}
An example JSON response for when a `remove` operation is requested for a
topic that had not been previously muted:
{generate_code_example|/users/me/subscriptions/muted_topics:patch|fixture(400_1)}
{generate_code_example|/users/me/subscriptions/muted_topics:patch|fixture(400)}

View File

@ -23,19 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/me/muted_users/{muted_user_id}:post|fixture(200)}
An example JSON response for when the user is yourself:
{generate_code_example|/users/me/muted_users/{muted_user_id}:post|fixture(400_0)}
An example JSON response for when the user is nonexistent or inaccessible:
{generate_code_example|/users/me/muted_users/{muted_user_id}:post|fixture(400_1)}
An example JSON response for when the user is already muted:
{generate_code_example|/users/me/muted_users/{muted_user_id}:post|fixture(400_2)}
{generate_code_example|/users/me/muted_users/{muted_user_id}:post|fixture(400)}

View File

@ -23,6 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/{user_id}/reactivate:post|fixture(200)}
{generate_code_example|/users/{user_id}/reactivate:post|fixture(400)}

View File

@ -76,6 +76,4 @@ More examples and documentation can be found [here](https://github.com/zulip/zul
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/register:post|fixture(200)}

View File

@ -23,6 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/realm/playgrounds/{playground_id}:delete|fixture(200)}
{generate_code_example|/realm/playgrounds/{playground_id}:delete|fixture(400)}

View File

@ -23,6 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/realm/filters/{filter_id}:delete|fixture(200)}
{generate_code_example|/realm/filters/{filter_id}:delete|fixture(400)}

View File

@ -25,6 +25,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/messages/{message_id}/reactions:delete|fixture(200)}
{generate_code_example|/messages/{message_id}/reactions:delete|fixture(400)}

View File

@ -23,10 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/user_groups/{user_group_id}:delete|fixture(200)}
An example JSON error response for an invalid user group id:
{generate_code_example|/user_groups/{user_group_id}:delete|fixture(400)}

View File

@ -33,6 +33,6 @@ More examples and documentation can be found [here](https://github.com/zulip/zul
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/messages/render:post|fixture(200)}
{generate_code_example|/messages/render:post|fixture(400)}

View File

@ -28,6 +28,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/realm/profile_fields:patch|fixture(200)}
{generate_code_example|/realm/profile_fields:patch|fixture(400)}

View File

@ -78,16 +78,7 @@ file.
{generate_return_values_table|zulip.yaml|/messages:post}
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/messages:post|fixture(200)}
A typical failed JSON response for when a stream message is sent to a stream
that does not exist:
{generate_code_example|/messages:post|fixture(400_0)}
A typical failed JSON response for when a private message is sent to a user
that does not exist:
{generate_code_example|/messages:post|fixture(400_1)}
{generate_code_example|/messages:post|fixture(400)}

View File

@ -29,6 +29,6 @@ More examples and documentation can be found [here](https://github.com/zulip/zul
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/typing:post|fixture(200)}
{generate_code_example|/typing:post|fixture(400)}

View File

@ -38,22 +38,6 @@ the `principals` parameter, like so:
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/me/subscriptions:post|fixture(200)}
{generate_code_example|/users/me/subscriptions:post|fixture(200_0)}
A typical successful JSON response when the user is already subscribed to
the streams specified:
{generate_code_example|/users/me/subscriptions:post|fixture(200_1)}
A typical response for when the requesting user does not have access to
a private stream and `authorization_errors_fatal` is `True`:
{generate_code_example|/users/me/subscriptions:post|fixture(400_0)}
A typical response for when the requesting user does not have access to
a private stream and `authorization_errors_fatal` is `False`:
{generate_code_example|/users/me/subscriptions:post|fixture(400_1)}
{generate_code_example|/users/me/subscriptions:post|fixture(400)}

View File

@ -23,14 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/me/muted_users/{muted_user_id}:delete|fixture(200)}
An example JSON response for when the user is nonexistent or inaccessible:
{generate_code_example|/users/me/muted_users/{muted_user_id}:delete|fixture(400_0)}
An example JSON response for when the user is not previously muted:
{generate_code_example|/users/me/muted_users/{muted_user_id}:delete|fixture(400_1)}
{generate_code_example|/users/me/muted_users/{muted_user_id}:delete|fixture(400)}

View File

@ -38,10 +38,6 @@ administrative privileges.
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/me/subscriptions:delete|fixture(200)}
A typical failed JSON response for when the target stream does not exist:
{generate_code_example|/users/me/subscriptions:delete|fixture(400)}

View File

@ -30,6 +30,6 @@ those ones that were different from the already existing setting.
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/settings/display:patch|fixture(200)}
{generate_code_example|/settings/display:patch|fixture(400)}

View File

@ -27,6 +27,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/realm/filters/{filter_id}:patch|fixture(200)}
{generate_code_example|/realm/filters/{filter_id}:patch|fixture(400)}

View File

@ -106,6 +106,6 @@ More examples and documentation can be found [here](https://github.com/zulip/zul
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/messages/flags:post|fixture(200)}
{generate_code_example|/messages/flags:post|fixture(400)}

View File

@ -38,11 +38,6 @@ You only have permission to edit a message if:
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/messages/{message_id}:patch|fixture(200)}
A typical JSON response for when one doesn't have the permission to
edit a particular message:
{generate_code_example|/messages/{message_id}:patch|fixture(400)}

View File

@ -30,6 +30,6 @@ those ones that were different than the already existing setting.
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/settings/notifications:patch|fixture(200)}
{generate_code_example|/settings/notifications:patch|fixture(400)}

View File

@ -23,10 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/streams/{stream_id}:patch|fixture(200)}
An example JSON response for when the supplied stream does not exist:
{generate_code_example|/streams/{stream_id}:patch|fixture(400)}

View File

@ -27,6 +27,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/me/subscriptions/properties:post|fixture(200)}
{generate_code_example|/users/me/subscriptions/properties:post|fixture(400)}

View File

@ -23,6 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/user_groups/{user_group_id}/members:post|fixture(200)}
{generate_code_example|/user_groups/{user_group_id}/members:post|fixture(400)}

View File

@ -23,10 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/user_groups/{user_group_id}:patch|fixture(200)}
An example JSON response when the user group ID is invalid:
{generate_code_example|/user_groups/{user_group_id}:patch|fixture(400)}

View File

@ -23,10 +23,6 @@
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/users/{user_id}:patch|fixture(200)}
A typical unsuccessful JSON response:
{generate_code_example|/users/{user_id}:patch|fixture(400)}

View File

@ -41,6 +41,6 @@ to 5MB.
## Response
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/realm/emoji/{emoji_name}:post|fixture(200)}
{generate_code_example|/realm/emoji/{emoji_name}:post|fixture(400)}

View File

@ -38,6 +38,6 @@ to 25MB.
#### Example response
A typical successful JSON response may look like:
{generate_code_example|/user_uploads:post|fixture(200)}
{generate_code_example|/user_uploads:post|fixture(400)}