mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
openapi: Render all responses of an operation.
Previously, one needed to specifying all the HTTP status codes that we want to render along with the operation, but the primary use case just needs the responses of all the status codes, and not just one. This commit modifies the Markdown extension to render all the responses of all status codes of a specified operation in a loop.
This commit is contained in:
committed by
GitHub
parent
db7d2ee713
commit
981e4f8946
@@ -451,14 +451,12 @@ class APICodeExamplesPreprocessor(Preprocessor):
|
||||
language, options = parse_language_and_options(match.group(2))
|
||||
function = match.group(3)
|
||||
key = match.group(4)
|
||||
argument = match.group(6)
|
||||
if self.api_url is None:
|
||||
raise AssertionError("Cannot render curl API examples without API URL set.")
|
||||
options["api_url"] = self.api_url
|
||||
|
||||
if key == "fixture":
|
||||
if argument:
|
||||
text = self.render_fixture(function, name=argument)
|
||||
text = self.render_fixture(function)
|
||||
elif key == "example":
|
||||
path, method = function.rsplit(":", 1)
|
||||
if language in ADMIN_CONFIG_LANGUAGES and check_requires_administrator(
|
||||
@@ -484,9 +482,9 @@ class APICodeExamplesPreprocessor(Preprocessor):
|
||||
done = True
|
||||
return lines
|
||||
|
||||
def render_fixture(self, function: str, name: str) -> List[str]:
|
||||
def render_fixture(self, function: str) -> List[str]:
|
||||
path, method = function.rsplit(":", 1)
|
||||
return generate_openapi_fixture(path, method, name)
|
||||
return generate_openapi_fixture(path, method)
|
||||
|
||||
|
||||
class APIDescriptionPreprocessor(Preprocessor):
|
||||
|
||||
Reference in New Issue
Block a user