mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 02:17:19 +00:00
bugdown: Show example value for path params in curl example.
This commit is contained in:
@@ -153,7 +153,15 @@ def generate_curl_example(endpoint: str, method: str,
|
||||
openapi_entry = openapi_spec.spec()['paths'][endpoint][method.lower()]
|
||||
openapi_params = openapi_entry.get("parameters", [])
|
||||
|
||||
curl_first_line_parts = ["curl"] + curl_method_arguments(endpoint, method,
|
||||
format_dict = {}
|
||||
for param in openapi_params:
|
||||
if param["in"] != "path":
|
||||
continue
|
||||
example_value = get_openapi_param_example_value_as_string(endpoint, method, param)
|
||||
format_dict[param["name"]] = example_value
|
||||
example_endpoint = endpoint.format_map(format_dict)
|
||||
|
||||
curl_first_line_parts = ["curl"] + curl_method_arguments(example_endpoint, method,
|
||||
api_url)
|
||||
lines.append(" ".join(curl_first_line_parts))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user