mirror of https://github.com/zulip/zulip.git
docs: Make upload-custom-emoji use curl example system.
This commit is contained in:
parent
438c4b2935
commit
9ac77a8734
|
@ -16,11 +16,7 @@ organization. Access to this endpoint depends on the
|
||||||
|
|
||||||
{tab|curl}
|
{tab|curl}
|
||||||
|
|
||||||
``` curl
|
{generate_code_example(curl)|/realm/emoji/{emoji_name}:post|example}
|
||||||
curl -X POST {{ api_url }}/v1/realm/emoji/{emoji_name} \
|
|
||||||
-F "data=@/path/to/img.png" \
|
|
||||||
-u USER_EMAIL:API_KEY
|
|
||||||
```
|
|
||||||
|
|
||||||
{end_tabs}
|
{end_tabs}
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,11 @@ def generate_curl_example(endpoint: str, method: str,
|
||||||
curl_argument=True)
|
curl_argument=True)
|
||||||
lines.append(example_value)
|
lines.append(example_value)
|
||||||
|
|
||||||
|
if "requestBody" in openapi_entry:
|
||||||
|
properties = openapi_entry["requestBody"]["content"]["multipart/form-data"]["schema"]["properties"]
|
||||||
|
for key, property in properties.items():
|
||||||
|
lines.append(' -F "{}=@{}"'.format(key, property["example"]))
|
||||||
|
|
||||||
for i in range(1, len(lines)-1):
|
for i in range(1, len(lines)-1):
|
||||||
lines[i] = lines[i] + " \\"
|
lines[i] = lines[i] + " \\"
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ exclude_list = [
|
||||||
'remove-linkifiers.md',
|
'remove-linkifiers.md',
|
||||||
# Endpoint does not accept bot requests
|
# Endpoint does not accept bot requests
|
||||||
'get-user-groups.md',
|
'get-user-groups.md',
|
||||||
|
# Example files do not exist
|
||||||
|
'upload-custom-emoji.md',
|
||||||
]
|
]
|
||||||
|
|
||||||
def test_generated_curl_examples_for_success(client: Client) -> None:
|
def test_generated_curl_examples_for_success(client: Client) -> None:
|
||||||
|
|
|
@ -1747,6 +1747,7 @@ paths:
|
||||||
filename:
|
filename:
|
||||||
type: string
|
type: string
|
||||||
format: binary
|
format: binary
|
||||||
|
example: /path/to/img.png
|
||||||
security:
|
security:
|
||||||
- basicAuth: []
|
- basicAuth: []
|
||||||
responses:
|
responses:
|
||||||
|
|
Loading…
Reference in New Issue