openapi: Auto render response descriptions.

This commit modifies the templates to
auto-generate general descriptions of
responses directly from the newly
added field of x-response-description
as a part of the goal of a common template.
This commit is contained in:
Suyash Vardhan Mathur 2021-06-22 01:09:57 +05:30 committed by Tim Abbott
parent cc2aa41fae
commit 5f07c06040
60 changed files with 124 additions and 0 deletions

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/realm/playgrounds:post} {generate_return_values_table|zulip.yaml|/realm/playgrounds:post}
{generate_response_description(/realm/playgrounds:post)}
#### Example response #### Example response
{generate_code_example|/realm/playgrounds:post|fixture(200)} {generate_code_example|/realm/playgrounds:post|fixture(200)}

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/realm/filters:post} {generate_return_values_table|zulip.yaml|/realm/filters:post}
{generate_response_description(/realm/filters:post)}
#### Example response #### Example response
{generate_code_example|/realm/filters:post|fixture(200)} {generate_code_example|/realm/filters:post|fixture(200)}

View File

@ -26,6 +26,8 @@
## Response ## Response
{generate_response_description(/messages/{message_id}/reactions:post)}
#### Example response #### Example response
{generate_code_example|/messages/{message_id}/reactions:post|fixture(200)} {generate_code_example|/messages/{message_id}/reactions:post|fixture(200)}

View File

@ -27,6 +27,8 @@
## Response ## Response
{generate_response_description(/streams/{stream_id}:delete)}
#### Example response #### Example response
{generate_code_example|/streams/{stream_id}:delete|fixture(200)} {generate_code_example|/streams/{stream_id}:delete|fixture(200)}

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/messages/matches_narrow:get} {generate_return_values_table|zulip.yaml|/messages/matches_narrow:get}
{generate_response_description(/messages/matches_narrow:get)}
#### Example response #### Example response
{generate_code_example|/messages/matches_narrow:get|fixture(200)} {generate_code_example|/messages/matches_narrow:get|fixture(200)}

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/realm/profile_fields:post} {generate_return_values_table|zulip.yaml|/realm/profile_fields:post}
{generate_response_description(/realm/profile_fields:post)}
#### Example response #### Example response
{generate_code_example|/realm/profile_fields:post|fixture(200)} {generate_code_example|/realm/profile_fields:post|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/user_groups/create:post)}
#### Example response #### Example response
{generate_code_example|/user_groups/create:post|fixture(200)} {generate_code_example|/user_groups/create:post|fixture(200)}

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/users:post} {generate_return_values_table|zulip.yaml|/users:post}
{generate_response_description(/users:post)}
#### Example response #### Example response
{generate_code_example|/users:post|fixture(200)} {generate_code_example|/users:post|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/users/me:delete)}
#### Example response #### Example response
{generate_code_example|/users/me:delete|fixture(200)} {generate_code_example|/users/me:delete|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/users/{user_id}:delete)}
#### Example response #### Example response
{generate_code_example|/users/{user_id}:delete|fixture(200)} {generate_code_example|/users/{user_id}:delete|fixture(200)}

View File

@ -27,6 +27,8 @@
## Response ## Response
{generate_response_description(/messages/{message_id}:delete)}
#### Example response #### Example response
{generate_code_example|/messages/{message_id}:delete|fixture(200)} {generate_code_example|/messages/{message_id}:delete|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/events:delete)}
#### Example response #### Example response
{generate_code_example|/events:delete|fixture(200)} {generate_code_example|/events:delete|fixture(200)}

View File

@ -21,6 +21,8 @@
{generate_return_values_table|zulip.yaml|/dev_fetch_api_key:post} {generate_return_values_table|zulip.yaml|/dev_fetch_api_key:post}
{generate_response_description(/dev_fetch_api_key:post)}
#### Example response #### Example response
{generate_code_example|/dev_fetch_api_key:post|fixture(200)} {generate_code_example|/dev_fetch_api_key:post|fixture(200)}

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/attachments:get} {generate_return_values_table|zulip.yaml|/attachments:get}
{generate_response_description(/attachments:get)}
#### Example response #### Example response
{generate_code_example|/attachments:get|fixture(200)} {generate_code_example|/attachments:get|fixture(200)}

View File

@ -28,6 +28,8 @@
{generate_return_values_table|zulip.yaml|/realm/emoji:get} {generate_return_values_table|zulip.yaml|/realm/emoji:get}
{generate_response_description(/realm/emoji:get)}
#### Example response #### Example response
{generate_code_example|/realm/emoji:get|fixture(200)} {generate_code_example|/realm/emoji:get|fixture(200)}

View File

@ -28,6 +28,8 @@
{generate_return_values_table|zulip.yaml|/realm/profile_fields:get} {generate_return_values_table|zulip.yaml|/realm/profile_fields:get}
{generate_response_description(/realm/profile_fields:get)}
#### Example response #### Example response
{generate_code_example|/realm/profile_fields:get|fixture(200)} {generate_code_example|/realm/profile_fields:get|fixture(200)}

View File

@ -51,6 +51,8 @@ endpoint and a queue would be registered in the absence of a `queue_id`.
{generate_return_values_table|zulip.yaml|/events:get} {generate_return_values_table|zulip.yaml|/events:get}
{generate_response_description(/events:get)}
#### Example response #### Example response
{generate_code_example|/events:get|fixture(200)} {generate_code_example|/events:get|fixture(200)}

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/realm/linkifiers:get} {generate_return_values_table|zulip.yaml|/realm/linkifiers:get}
{generate_response_description(/realm/linkifiers:get)}
#### Example response #### Example response
{generate_code_example|/realm/linkifiers:get|fixture(200)} {generate_code_example|/realm/linkifiers:get|fixture(200)}

View File

@ -37,6 +37,8 @@ will only contain data for the modified fields (e.g. if only the topic
was edited, `prev_content`, `prev_rendered_content`, and was edited, `prev_content`, `prev_rendered_content`, and
`content_html_diff` will not appear). `content_html_diff` will not appear).
{generate_response_description(/messages/{message_id}/history:get)}
#### Example response #### Example response
{generate_code_example|/messages/{message_id}/history:get|fixture(200)} {generate_code_example|/messages/{message_id}/history:get|fixture(200)}

View File

@ -31,6 +31,8 @@ present in all Zulip API responses).
{generate_return_values_table|zulip.yaml|/messages:get} {generate_return_values_table|zulip.yaml|/messages:get}
{generate_response_description(/messages:get)}
#### Example response #### Example response
{generate_code_example|/messages:get|fixture(200)} {generate_code_example|/messages:get|fixture(200)}

View File

@ -27,6 +27,8 @@ This endpoint takes no parameters.
{generate_return_values_table|zulip.yaml|/users/me:get} {generate_return_values_table|zulip.yaml|/users/me:get}
{generate_response_description(/users/me:get)}
#### Example response #### Example response
{generate_code_example|/users/me:get|fixture(200)} {generate_code_example|/users/me:get|fixture(200)}

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/messages/{message_id}:get} {generate_return_values_table|zulip.yaml|/messages/{message_id}:get}
{generate_response_description(/messages/{message_id}:get)}
#### Example response #### Example response
{generate_code_example|/messages/{message_id}:get|fixture(200)} {generate_code_example|/messages/{message_id}:get|fixture(200)}

View File

@ -39,6 +39,8 @@ response, for two reasons:
multi-subdomain server, like the root domain of zulip.com, the settings multi-subdomain server, like the root domain of zulip.com, the settings
that are realm-specific are not known and thus not provided. that are realm-specific are not known and thus not provided.
{generate_response_description(/server_settings:get)}
#### Example response #### Example response
{generate_code_example|/server_settings:get|fixture(200)} {generate_code_example|/server_settings:get|fixture(200)}

View File

@ -29,6 +29,8 @@
{generate_return_values_table|zulip.yaml|/get_stream_id:get} {generate_return_values_table|zulip.yaml|/get_stream_id:get}
{generate_response_description(/get_stream_id:get)}
#### Example response #### Example response
{generate_code_example|/get_stream_id:get|fixture(200)} {generate_code_example|/get_stream_id:get|fixture(200)}

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/users/me/{stream_id}/topics:get} {generate_return_values_table|zulip.yaml|/users/me/{stream_id}/topics:get}
{generate_response_description(/users/me/{stream_id}/topics:get)}
#### Example response #### Example response
{generate_code_example|/users/me/{stream_id}/topics:get|fixture(200)} {generate_code_example|/users/me/{stream_id}/topics:get|fixture(200)}

View File

@ -29,6 +29,8 @@
{generate_return_values_table|zulip.yaml|/streams:get} {generate_return_values_table|zulip.yaml|/streams:get}
{generate_response_description(/streams:get)}
#### Example response #### Example response
{generate_code_example|/streams:get|fixture(200)} {generate_code_example|/streams:get|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/users/{user_id}/subscriptions/{stream_id}:get)}
#### Example response #### Example response
{generate_code_example|/users/{user_id}/subscriptions/{stream_id}:get|fixture(200)} {generate_code_example|/users/{user_id}/subscriptions/{stream_id}:get|fixture(200)}

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/users/me/subscriptions:get} {generate_return_values_table|zulip.yaml|/users/me/subscriptions:get}
{generate_response_description(/users/me/subscriptions:get)}
#### Example response #### Example response
{generate_code_example|/users/me/subscriptions:get|fixture(200)} {generate_code_example|/users/me/subscriptions:get|fixture(200)}

View File

@ -29,6 +29,8 @@
{generate_return_values_table|zulip.yaml}|/users/{email}:get} {generate_return_values_table|zulip.yaml}|/users/{email}:get}
{generate_response_description(/users/{email}:get)}
#### Example response #### Example response
{generate_code_example|/users/{email}:get|fixture(200)} {generate_code_example|/users/{email}:get|fixture(200)}

View File

@ -29,6 +29,8 @@
{generate_return_values_table|zulip.yaml|/user_groups:get} {generate_return_values_table|zulip.yaml|/user_groups:get}
{generate_response_description(/user_groups:get)}
#### Example response #### Example response
{generate_code_example|/user_groups:get|fixture(200)} {generate_code_example|/user_groups:get|fixture(200)}

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/users/{user_id_or_email}/presence:get} {generate_return_values_table|zulip.yaml|/users/{user_id_or_email}/presence:get}
{generate_response_description(/users/{user_id_or_email}/presence:get)}
#### Example response #### Example response
{generate_code_example|/users/{user_id_or_email}/presence:get|fixture(200)} {generate_code_example|/users/{user_id_or_email}/presence:get|fixture(200)}

View File

@ -29,6 +29,8 @@
{generate_return_values_table|zulip.yaml}|/users/{user_id}:get} {generate_return_values_table|zulip.yaml}|/users/{user_id}:get}
{generate_response_description(/users/{user_id}:get)}
#### Example response #### Example response
{generate_code_example|/users/{user_id}:get|fixture(200)} {generate_code_example|/users/{user_id}:get|fixture(200)}

View File

@ -29,6 +29,8 @@
{generate_return_values_table|zulip.yaml|/users:get} {generate_return_values_table|zulip.yaml|/users:get}
{generate_response_description(/users:get)}
#### Example response #### Example response
{generate_code_example|/users:get|fixture(200)} {generate_code_example|/users:get|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/mark_all_as_read:post)}
#### Example response #### Example response
{generate_code_example|/mark_all_as_read:post|fixture(200)} {generate_code_example|/mark_all_as_read:post|fixture(200)}
@ -60,6 +62,8 @@
## Response ## Response
{generate_response_description(/mark_all_as_read:post)}
#### Example response #### Example response
{generate_code_example|/mark_stream_as_read:post|fixture(200)} {generate_code_example|/mark_stream_as_read:post|fixture(200)}
@ -96,6 +100,8 @@
## Response ## Response
{generate_response_description(/mark_all_as_read:post)}
#### Example response #### Example response
{generate_code_example|/mark_topic_as_read:post|fixture(200)} {generate_code_example|/mark_topic_as_read:post|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/users/me/subscriptions/muted_topics:patch)}
#### Example response #### Example response
{generate_code_example|/users/me/subscriptions/muted_topics:patch|fixture(200)} {generate_code_example|/users/me/subscriptions/muted_topics:patch|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/users/me/muted_users/{muted_user_id}:post)}
#### Example response #### Example response
{generate_code_example|/users/me/muted_users/{muted_user_id}:post|fixture(200)} {generate_code_example|/users/me/muted_users/{muted_user_id}:post|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/users/{user_id}/reactivate:post)}
#### Example response #### Example response
{generate_code_example|/users/{user_id}/reactivate:post|fixture(200)} {generate_code_example|/users/{user_id}/reactivate:post|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/realm/playgrounds/{playground_id}:delete)}
#### Example response #### Example response
{generate_code_example|/realm/playgrounds/{playground_id}:delete|fixture(200)} {generate_code_example|/realm/playgrounds/{playground_id}:delete|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/realm/filters/{filter_id}:delete)}
#### Example response #### Example response
{generate_code_example|/realm/filters/{filter_id}:delete|fixture(200)} {generate_code_example|/realm/filters/{filter_id}:delete|fixture(200)}

View File

@ -27,6 +27,8 @@
## Response ## Response
{generate_response_description(/messages/{message_id}/reactions:delete)}
#### Example response #### Example response
{generate_code_example|/messages/{message_id}/reactions:delete|fixture(200)} {generate_code_example|/messages/{message_id}/reactions:delete|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/user_groups/{user_group_id}:delete)}
#### Example response #### Example response
{generate_code_example|/user_groups/{user_group_id}:delete|fixture(200)} {generate_code_example|/user_groups/{user_group_id}:delete|fixture(200)}

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/messages/render:post} {generate_return_values_table|zulip.yaml|/messages/render:post}
{generate_response_description(/messages/render:post)}
#### Example response #### Example response
{generate_code_example|/messages/render:post|fixture(200)} {generate_code_example|/messages/render:post|fixture(200)}

View File

@ -28,6 +28,8 @@
{generate_return_values_table|zulip.yaml|/realm/profile_fields:patch} {generate_return_values_table|zulip.yaml|/realm/profile_fields:patch}
{generate_response_description(/realm/profile_fields:patch)}
#### Example response #### Example response
{generate_code_example|/realm/profile_fields:patch|fixture(200)} {generate_code_example|/realm/profile_fields:patch|fixture(200)}

View File

@ -73,6 +73,8 @@ file.
{generate_return_values_table|zulip.yaml|/messages:post} {generate_return_values_table|zulip.yaml|/messages:post}
{generate_response_description(/messages:post)}
#### Example response #### Example response
{generate_code_example|/messages:post|fixture(200)} {generate_code_example|/messages:post|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/typing:post)}
#### Example response #### Example response
{generate_code_example|/typing:post|fixture(200)} {generate_code_example|/typing:post|fixture(200)}

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/users/me/subscriptions:post} {generate_return_values_table|zulip.yaml|/users/me/subscriptions:post}
{generate_response_description(/users/me/subscriptions:post)}
#### Example response #### Example response
{generate_code_example|/users/me/subscriptions:post|fixture(200)} {generate_code_example|/users/me/subscriptions:post|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/users/me/muted_users/{muted_user_id}:delete)}
#### Example response #### Example response
{generate_code_example|/users/me/muted_users/{muted_user_id}:delete|fixture(200)} {generate_code_example|/users/me/muted_users/{muted_user_id}:delete|fixture(200)}

View File

@ -23,6 +23,8 @@
{generate_return_values_table|zulip.yaml|/users/me/subscriptions:delete} {generate_return_values_table|zulip.yaml|/users/me/subscriptions:delete}
{generate_response_description(/users/me/subscriptions:delete)}
#### Example response #### Example response
{generate_code_example|/users/me/subscriptions:delete|fixture(200)} {generate_code_example|/users/me/subscriptions:delete|fixture(200)}

View File

@ -32,6 +32,8 @@ with their new value. Please note that this doesn't necessarily mean that it
will return all the settings passed as parameters in the request, but only will return all the settings passed as parameters in the request, but only
those ones that were different from the already existing setting. those ones that were different from the already existing setting.
{generate_response_description(/settings/display:patch)}
#### Example response #### Example response
{generate_code_example|/settings/display:patch|fixture(200)} {generate_code_example|/settings/display:patch|fixture(200)}

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/realm/filters/{filter_id}:patch} {generate_return_values_table|zulip.yaml|/realm/filters/{filter_id}:patch}
{generate_response_description(/realm/filters/{filter_id}:patch)}
#### Example response #### Example response
{generate_code_example|/realm/filters/{filter_id}:patch|fixture(200)} {generate_code_example|/realm/filters/{filter_id}:patch|fixture(200)}

View File

@ -99,6 +99,8 @@
{generate_return_values_table|zulip.yaml|/messages/flags:post} {generate_return_values_table|zulip.yaml|/messages/flags:post}
{generate_response_description(/messages/flags:post)}
#### Example response #### Example response
{generate_code_example|/messages/flags:post|fixture(200)} {generate_code_example|/messages/flags:post|fixture(200)}

View File

@ -34,6 +34,8 @@ You only have permission to edit a message if:
## Response ## Response
{generate_response_description(/messages/{message_id}:patch)}
#### Example response #### Example response
{generate_code_example|/messages/{message_id}:patch|fixture(200)} {generate_code_example|/messages/{message_id}:patch|fixture(200)}

View File

@ -32,6 +32,8 @@ with their new value. Please note that this doesn't necessarily mean that it
will return all the settings passed as parameters in the request, but only will return all the settings passed as parameters in the request, but only
those ones that were different than the already existing setting. those ones that were different than the already existing setting.
{generate_response_description(/settings/notifications:patch)}
#### Example response #### Example response
{generate_code_example|/settings/notifications:patch|fixture(200)} {generate_code_example|/settings/notifications:patch|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/streams/{stream_id}:patch)}
#### Example response #### Example response
{generate_code_example|/streams/{stream_id}:patch|fixture(200)} {generate_code_example|/streams/{stream_id}:patch|fixture(200)}

View File

@ -27,6 +27,8 @@
{generate_return_values_table|zulip.yaml|/users/me/subscriptions/properties:post} {generate_return_values_table|zulip.yaml|/users/me/subscriptions/properties:post}
{generate_response_description(/users/me/subscriptions/properties:post)}
#### Example response #### Example response
{generate_code_example|/users/me/subscriptions/properties:post|fixture(200)} {generate_code_example|/users/me/subscriptions/properties:post|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/user_groups/{user_group_id}/members:post)}
#### Example response #### Example response
{generate_code_example|/user_groups/{user_group_id}/members:post|fixture(200)} {generate_code_example|/user_groups/{user_group_id}/members:post|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/user_groups/{user_group_id}:patch)}
#### Example response #### Example response
{generate_code_example|/user_groups/{user_group_id}:patch|fixture(200)} {generate_code_example|/user_groups/{user_group_id}:patch|fixture(200)}

View File

@ -25,6 +25,8 @@
## Response ## Response
{generate_response_description(/users/{user_id}:patch)}
#### Example response #### Example response
{generate_code_example|/users/{user_id}:patch|fixture(200)} {generate_code_example|/users/{user_id}:patch|fixture(200)}

View File

@ -41,6 +41,8 @@ to 5MB.
[1]: https://zulip.readthedocs.io/en/latest/subsystems/settings.html#server-settings [1]: https://zulip.readthedocs.io/en/latest/subsystems/settings.html#server-settings
{generate_parameter_description(/realm/emoji/{emoji_name}:post)} {generate_parameter_description(/realm/emoji/{emoji_name}:post)}
{generate_response_description(/realm/emoji/{emoji_name}:post)}
## Response ## Response
#### Example response #### Example response

View File

@ -37,6 +37,8 @@ to 25MB.
{generate_return_values_table|zulip.yaml|/user_uploads:post} {generate_return_values_table|zulip.yaml|/user_uploads:post}
{generate_response_description(/user_uploads:post)}
#### Example response #### Example response
{generate_code_example|/user_uploads:post|fixture(200)} {generate_code_example|/user_uploads:post|fixture(200)}