mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
bugdown: Remove unecessary call to get_openapi_parameters.
This commit is contained in:
@@ -8,8 +8,7 @@ from typing import Any, Dict, Optional, List, Tuple
|
|||||||
import markdown
|
import markdown
|
||||||
|
|
||||||
import zerver.openapi.python_examples
|
import zerver.openapi.python_examples
|
||||||
from zerver.lib.openapi import get_openapi_fixture, openapi_spec, \
|
from zerver.lib.openapi import get_openapi_fixture, openapi_spec
|
||||||
get_openapi_parameters
|
|
||||||
|
|
||||||
MACRO_REGEXP = re.compile(r'\{generate_code_example(\(\s*(.+?)\s*\))*\|\s*(.+?)\s*\|\s*(.+?)\s*(\(\s*(.+)\s*\))?\}')
|
MACRO_REGEXP = re.compile(r'\{generate_code_example(\(\s*(.+?)\s*\))*\|\s*(.+?)\s*\|\s*(.+?)\s*(\(\s*(.+)\s*\))?\}')
|
||||||
CODE_EXAMPLE_REGEX = re.compile(r'\# \{code_example\|\s*(.+?)\s*\}')
|
CODE_EXAMPLE_REGEX = re.compile(r'\# \{code_example\|\s*(.+?)\s*\}')
|
||||||
@@ -128,6 +127,7 @@ def generate_curl_example(endpoint: str, method: str,
|
|||||||
exclude: List[str]=[]) -> List[str]:
|
exclude: List[str]=[]) -> List[str]:
|
||||||
lines = ["```curl"]
|
lines = ["```curl"]
|
||||||
openapi_entry = openapi_spec.spec()['paths'][endpoint][method.lower()]
|
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,
|
curl_first_line_parts = ["curl"] + curl_method_arguments(endpoint, method,
|
||||||
api_url)
|
api_url)
|
||||||
@@ -137,7 +137,6 @@ def generate_curl_example(endpoint: str, method: str,
|
|||||||
if authentication_required:
|
if authentication_required:
|
||||||
lines.append(" -u %s:%s" % (auth_email, auth_api_key))
|
lines.append(" -u %s:%s" % (auth_email, auth_api_key))
|
||||||
|
|
||||||
openapi_params = get_openapi_parameters(endpoint, method)
|
|
||||||
for param in openapi_params:
|
for param in openapi_params:
|
||||||
param_name = param["name"]
|
param_name = param["name"]
|
||||||
if param_name in exclude:
|
if param_name in exclude:
|
||||||
|
|||||||
Reference in New Issue
Block a user