mirror of https://github.com/zulip/zulip.git
openapi: Standardize URL format to use {var_name} syntax.
The previous code for the validator test was fairly messy due to checking for both formats of the openapi url, one with <variable_name> and the other with {variable_name}. To eliminate this, we have standardized the format and restricted it to {variable_name} as per the official format at: https://swagger.io/docs/specification/describing-parameters.
This commit is contained in:
parent
fe59c31e85
commit
ffd2bccd4e
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Permanently delete a message.
|
Permanently delete a message.
|
||||||
|
|
||||||
`DELETE {{ api_url }}/v1/messages/<msg_id>`
|
`DELETE {{ api_url }}/v1/messages/{msg_id}`
|
||||||
|
|
||||||
This API corresponds to the
|
This API corresponds to the
|
||||||
[delete a message completely][delete-completely] feature documented in
|
[delete a message completely][delete-completely] feature documented in
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Fetch the message edit history of a previously edited message.
|
Fetch the message edit history of a previously edited message.
|
||||||
|
|
||||||
`GET {{ api_url }}/v1/messages/<message_id>/history`
|
`GET {{ api_url }}/v1/messages/{message_id}/history`
|
||||||
|
|
||||||
Note that edit history may be disabled in some organizations; see the
|
Note that edit history may be disabled in some organizations; see the
|
||||||
[Zulip Help Center documentation on editing messages][edit-settings].
|
[Zulip Help Center documentation on editing messages][edit-settings].
|
||||||
|
@ -19,7 +19,7 @@ Note that edit history may be disabled in some organizations; see the
|
||||||
{tab|curl}
|
{tab|curl}
|
||||||
|
|
||||||
``` curl
|
``` curl
|
||||||
curl -X GET {{ api_url }}/v1/messages/<message_id>/history \
|
curl -X GET {{ api_url }}/v1/messages/{message_id}/history \
|
||||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ Zulip clients like mobile/desktop apps will want to use the main
|
||||||
presence endpoint, which returns data for all active users in the
|
presence endpoint, which returns data for all active users in the
|
||||||
organization, instead.
|
organization, instead.
|
||||||
|
|
||||||
`GET {{ api_url }}/v1/users/<email>/presence`
|
`GET {{ api_url }}/v1/users/{email}/presence`
|
||||||
|
|
||||||
See
|
See
|
||||||
[Zulip's developer documentation](https://zulip.readthedocs.io/en/latest/subsystems/presence.html)
|
[Zulip's developer documentation](https://zulip.readthedocs.io/en/latest/subsystems/presence.html)
|
||||||
|
@ -24,7 +24,7 @@ for details on the data model for presence in Zulip.
|
||||||
{tab|curl}
|
{tab|curl}
|
||||||
|
|
||||||
``` curl
|
``` curl
|
||||||
curl -X GET {{ api_url }}/v1/users/<email>/presence \
|
curl -X GET {{ api_url }}/v1/users/{email}/presence \
|
||||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ curl -X GET {{ api_url }}/v1/users/<email>/presence \
|
||||||
|
|
||||||
* `presence`: An object containing the presence details for every type
|
* `presence`: An object containing the presence details for every type
|
||||||
of client the user has ever logged into.
|
of client the user has ever logged into.
|
||||||
* `<client_name>` or `aggregated`: the keys for these objects are
|
* `{client_name}` or `aggregated`: the keys for these objects are
|
||||||
the names of the different clients where this user is logged in,
|
the names of the different clients where this user is logged in,
|
||||||
like `website`, `ZulipDesktop`, `ZulipTerminal`, or
|
like `website`, `ZulipDesktop`, `ZulipTerminal`, or
|
||||||
`ZulipMobile`. There is also an `aggregated` key, which matches
|
`ZulipMobile`. There is also an `aggregated` key, which matches
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Get the raw content of a message.
|
Get the raw content of a message.
|
||||||
|
|
||||||
`GET {{ api_url }}/v1/messages/<msg_id>`
|
`GET {{ api_url }}/v1/messages/{msg_id}`
|
||||||
|
|
||||||
This is a rarely-used endpoint relevant for clients that primarily
|
This is a rarely-used endpoint relevant for clients that primarily
|
||||||
work with HTML-rendered messages but might need to occasionally fetch
|
work with HTML-rendered messages but might need to occasionally fetch
|
||||||
|
@ -19,7 +19,7 @@ UI).
|
||||||
{tab|curl}
|
{tab|curl}
|
||||||
|
|
||||||
``` curl
|
``` curl
|
||||||
curl -X GET {{ api_url }}/v1/messages/<msg_id> \
|
curl -X GET {{ api_url }}/v1/messages/{msg_id} \
|
||||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Get all the topics in a specific stream
|
Get all the topics in a specific stream
|
||||||
|
|
||||||
`GET {{ api_url }}/v1/users/me/<stream_id>/topics`
|
`GET {{ api_url }}/v1/users/me/{stream_id}/topics`
|
||||||
|
|
||||||
## Usage examples
|
## Usage examples
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ zulip(config).then((client) => {
|
||||||
{tab|curl}
|
{tab|curl}
|
||||||
|
|
||||||
``` curl
|
``` curl
|
||||||
curl -X GET {{ api_url }}/v1/users/me/<stream_id>/topics \
|
curl -X GET {{ api_url }}/v1/users/me/{stream_id}/topics \
|
||||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -4,19 +4,19 @@ Remove [linkifiers](/help/add-a-custom-linkification-filter), regular
|
||||||
expression patterns that are automatically linkified when they appear
|
expression patterns that are automatically linkified when they appear
|
||||||
in messages and topics.
|
in messages and topics.
|
||||||
|
|
||||||
`DELETE {{ api_url }}/v1/realm/filters/<filter_id>`
|
`DELETE {{ api_url }}/v1/realm/filters/{filter_id}`
|
||||||
|
|
||||||
## Usage examples
|
## Usage examples
|
||||||
|
|
||||||
{start_tabs}
|
{start_tabs}
|
||||||
{tab|python}
|
{tab|python}
|
||||||
|
|
||||||
{generate_code_example(python)|/realm/filters/<filter_id>:delete|example}
|
{generate_code_example(python)|/realm/filters/{filter_id}:delete|example}
|
||||||
|
|
||||||
{tab|curl}
|
{tab|curl}
|
||||||
|
|
||||||
``` curl
|
``` curl
|
||||||
curl -X DELETE {{ api_url }}/v1/realm/filters/<filter_id> \
|
curl -X DELETE {{ api_url }}/v1/realm/filters/{filter_id} \
|
||||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ curl -X DELETE {{ api_url }}/v1/realm/filters/<filter_id> \
|
||||||
|
|
||||||
## Arguments
|
## Arguments
|
||||||
|
|
||||||
{generate_api_arguments_table|zulip.yaml|/realm/filters/<filter_id>:delete}
|
{generate_api_arguments_table|zulip.yaml|/realm/filters/{filter_id}:delete}
|
||||||
|
|
||||||
## Response
|
## Response
|
||||||
|
|
||||||
|
@ -32,4 +32,4 @@ curl -X DELETE {{ api_url }}/v1/realm/filters/<filter_id> \
|
||||||
|
|
||||||
A typical successful JSON response may look like:
|
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(200)}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
Edit/update the content or topic of a message.
|
Edit/update the content or topic of a message.
|
||||||
|
|
||||||
`PATCH {{ api_url }}/v1/messages/<msg_id>`
|
`PATCH {{ api_url }}/v1/messages/{msg_id}`
|
||||||
|
|
||||||
`<msg_id>` in the above URL should be replaced with the ID of the
|
`{msg_id}` in the above URL should be replaced with the ID of the
|
||||||
message you wish you update.
|
message you wish you update.
|
||||||
|
|
||||||
## Usage examples
|
## Usage examples
|
||||||
|
@ -39,7 +39,7 @@ zulip(config).then((client) => {
|
||||||
{tab|curl}
|
{tab|curl}
|
||||||
|
|
||||||
``` curl
|
``` curl
|
||||||
curl -X "PATCH" {{ api_url }}/v1/messages/<msg_id> \
|
curl -X "PATCH" {{ api_url }}/v1/messages/{msg_id} \
|
||||||
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
|
||||||
-d $"content=New content"
|
-d $"content=New content"
|
||||||
```
|
```
|
||||||
|
|
|
@ -4,7 +4,7 @@ This endpoint is used to upload a custom emoji for use in the user's
|
||||||
organization. Access to this endpoint depends on the
|
organization. Access to this endpoint depends on the
|
||||||
[organization's configuration](https://zulipchat.com/help/only-allow-admins-to-add-emoji).
|
[organization's configuration](https://zulipchat.com/help/only-allow-admins-to-add-emoji).
|
||||||
|
|
||||||
`POST {{ api_url }}/v1/realm/emoji/<emoji_name>`
|
`POST {{ api_url }}/v1/realm/emoji/{emoji_name}`
|
||||||
|
|
||||||
## Usage examples
|
## Usage examples
|
||||||
|
|
||||||
|
@ -12,12 +12,12 @@ organization. Access to this endpoint depends on the
|
||||||
|
|
||||||
{tab|python}
|
{tab|python}
|
||||||
|
|
||||||
{generate_code_example(python)|/realm/emoji/<emoji_name>:post|example}
|
{generate_code_example(python)|/realm/emoji/{emoji_name}:post|example}
|
||||||
|
|
||||||
{tab|curl}
|
{tab|curl}
|
||||||
|
|
||||||
``` curl
|
``` curl
|
||||||
curl -X POST {{ api_url }}/v1/realm/emoji/<emoji_name> \
|
curl -X POST {{ api_url }}/v1/realm/emoji/{emoji_name} \
|
||||||
-F "data=@/path/to/img.png" \
|
-F "data=@/path/to/img.png" \
|
||||||
-u USER_EMAIL:API_KEY
|
-u USER_EMAIL:API_KEY
|
||||||
```
|
```
|
||||||
|
@ -51,4 +51,4 @@ to 5MB.
|
||||||
|
|
||||||
A typical successful JSON response may look like:
|
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(200)}
|
||||||
|
|
|
@ -460,7 +460,7 @@ following helper method:
|
||||||
# self.assert_bot_response(...)
|
# self.assert_bot_response(...)
|
||||||
|
|
||||||
`mock_http_conversation(fixture_name)` patches `requests.get` and returns the data specified
|
`mock_http_conversation(fixture_name)` patches `requests.get` and returns the data specified
|
||||||
in the file `fixtures/<fixture_name>.json`. Use the following JSON code as a skeleton for new
|
in the file `fixtures/{fixture_name}.json`. Use the following JSON code as a skeleton for new
|
||||||
fixtures:
|
fixtures:
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
|
|
|
@ -195,7 +195,7 @@ def remove_realm_filter(client):
|
||||||
result = client.remove_realm_filter(42)
|
result = client.remove_realm_filter(42)
|
||||||
# {code_example|end}
|
# {code_example|end}
|
||||||
|
|
||||||
validate_against_openapi_schema(result, '/realm/filters/<filter_id>', 'delete', '200')
|
validate_against_openapi_schema(result, '/realm/filters/{filter_id}', 'delete', '200')
|
||||||
|
|
||||||
def get_profile(client):
|
def get_profile(client):
|
||||||
# type: (Client) -> None
|
# type: (Client) -> None
|
||||||
|
@ -861,7 +861,7 @@ def upload_custom_emoji(client):
|
||||||
# {code_example|end}
|
# {code_example|end}
|
||||||
fp.close()
|
fp.close()
|
||||||
validate_against_openapi_schema(result,
|
validate_against_openapi_schema(result,
|
||||||
'/realm/emoji/<emoji_name>',
|
'/realm/emoji/{emoji_name}',
|
||||||
'post', '200')
|
'post', '200')
|
||||||
|
|
||||||
def get_alert_words(client):
|
def get_alert_words(client):
|
||||||
|
@ -981,10 +981,10 @@ TEST_FUNCTIONS = {
|
||||||
'/users/me/subscriptions/properties:post': update_subscription_settings,
|
'/users/me/subscriptions/properties:post': update_subscription_settings,
|
||||||
'/users:get': get_members,
|
'/users:get': get_members,
|
||||||
'/realm/emoji:get': get_realm_emoji,
|
'/realm/emoji:get': get_realm_emoji,
|
||||||
'/realm/emoji/<emoji_name>:post': upload_custom_emoji,
|
'/realm/emoji/{emoji_name}:post': upload_custom_emoji,
|
||||||
'/realm/filters:get': get_realm_filters,
|
'/realm/filters:get': get_realm_filters,
|
||||||
'/realm/filters:post': add_realm_filter,
|
'/realm/filters:post': add_realm_filter,
|
||||||
'/realm/filters/<filter_id>:delete': remove_realm_filter,
|
'/realm/filters/{filter_id}:delete': remove_realm_filter,
|
||||||
'/register:post': register_queue,
|
'/register:post': register_queue,
|
||||||
'/events:delete': deregister_queue,
|
'/events:delete': deregister_queue,
|
||||||
'/server_settings:get': get_server_settings,
|
'/server_settings:get': get_server_settings,
|
||||||
|
|
|
@ -1369,7 +1369,7 @@ paths:
|
||||||
"msg": "Topic is not muted",
|
"msg": "Topic is not muted",
|
||||||
"result": "error"
|
"result": "error"
|
||||||
}
|
}
|
||||||
/realm/emoji/<emoji_name>:
|
/realm/emoji/{emoji_name}:
|
||||||
post:
|
post:
|
||||||
description: Upload a single emoji file.
|
description: Upload a single emoji file.
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -1568,7 +1568,7 @@ paths:
|
||||||
"result": "success",
|
"result": "success",
|
||||||
"msg": ""
|
"msg": ""
|
||||||
}
|
}
|
||||||
/realm/filters/<filter_id>:
|
/realm/filters/{filter_id}:
|
||||||
delete:
|
delete:
|
||||||
description: Remove an organization filter.
|
description: Remove an organization filter.
|
||||||
parameters:
|
parameters:
|
||||||
|
|
|
@ -191,29 +191,29 @@ class OpenAPIArgumentsTest(ZulipTestCase):
|
||||||
'/users/me/android_gcm_reg_id',
|
'/users/me/android_gcm_reg_id',
|
||||||
'/users/me/apns_device_token',
|
'/users/me/apns_device_token',
|
||||||
# Regex based urls
|
# Regex based urls
|
||||||
'/realm/domains/<domain>',
|
'/realm/domains/{domain}',
|
||||||
'/realm/filters/<filter_id>',
|
'/realm/filters/{filter_id}',
|
||||||
'/realm/profile_fields/<field_id>',
|
'/realm/profile_fields/{field_id}',
|
||||||
'/users/<user_id>/reactivate',
|
'/users/{user_id}/reactivate',
|
||||||
'/users/<user_id>',
|
'/users/{user_id}',
|
||||||
'/bots/<bot_id>/api_key/regenerate',
|
'/bots/{bot_id}/api_key/regenerate',
|
||||||
'/bots/<bot_id>',
|
'/bots/{bot_id}',
|
||||||
'/invites/<prereg_id>',
|
'/invites/{prereg_id}',
|
||||||
'/invites/<prereg_id>/resend',
|
'/invites/{prereg_id}/resend',
|
||||||
'/invites/multiuse/<invite_id>',
|
'/invites/multiuse/{invite_id}',
|
||||||
'/messages/{message_id}',
|
'/messages/{message_id}',
|
||||||
'/messages/{message_id}/history',
|
'/messages/{message_id}/history',
|
||||||
'/users/me/subscriptions/{stream_id}',
|
'/users/me/subscriptions/{stream_id}',
|
||||||
'/messages/<message_id>/reactions',
|
'/messages/{message_id}/reactions',
|
||||||
'/messages/<message_id>/emoji_reactions/<emoji_name>',
|
'/messages/{message_id}/emoji_reactions/{emoji_name}',
|
||||||
'/attachments/<attachment_id>',
|
'/attachments/{attachment_id}',
|
||||||
'/user_groups/<user_group_id>/members',
|
'/user_groups/{user_group_id}/members',
|
||||||
'/users/me/{stream_id}/topics',
|
'/users/me/{stream_id}/topics',
|
||||||
'/streams/<stream_id>/members',
|
'/streams/{stream_id}/members',
|
||||||
'/streams/{stream_id}',
|
'/streams/{stream_id}',
|
||||||
'/streams/<stream_id>/delete_topic',
|
'/streams/{stream_id}/delete_topic',
|
||||||
'/default_stream_groups/<group_id>',
|
'/default_stream_groups/{group_id}',
|
||||||
'/default_stream_groups/<group_id>/streams',
|
'/default_stream_groups/{group_id}/streams',
|
||||||
# Regex with an unnamed capturing group.
|
# Regex with an unnamed capturing group.
|
||||||
'/users/(?!me/)(?P<email>[^/]*)/presence',
|
'/users/(?!me/)(?P<email>[^/]*)/presence',
|
||||||
# Actually '/user_groups/<user_group_id>' in urls.py but fails the reverse mapping
|
# Actually '/user_groups/<user_group_id>' in urls.py but fails the reverse mapping
|
||||||
|
|
Loading…
Reference in New Issue