api_docs: Migrate POST /zulip-outgoing-webhook.

This commit migrates zulip outging webhook payload to
/zulip-outgoing-webhook:post in OpenAPI.

Since this migrates the last payloads from api/fixtures.json to
OpenAPI, this commit removes api/fixtures.json file and the functions
accessing the file.

Tweaked by tabbott to further remove an unnecessary conditional.
This commit is contained in:
shubhamgupta2956
2020-04-02 07:12:59 +05:30
committed by Tim Abbott
parent 6ebf408fc4
commit 793c3f25e7
6 changed files with 78 additions and 57 deletions

View File

@@ -300,8 +300,6 @@ class APICodeExamplesPreprocessor(Preprocessor):
if key == 'fixture':
if argument:
text = self.render_fixture(function, name=argument)
else:
text = self.render_fixture(function)
elif key == 'example':
if argument == 'admin_config=True':
text = SUPPORTED_LANGUAGES[language]['render'](function, admin_config=True)
@@ -325,15 +323,8 @@ class APICodeExamplesPreprocessor(Preprocessor):
def render_fixture(self, function: str, name: Optional[str]=None) -> List[str]:
fixture = []
# We assume that if the function we're rendering starts with a slash
# it's a path in the endpoint and therefore it uses the new OpenAPI
# format.
if function.startswith('/'):
path, method = function.rsplit(':', 1)
fixture_dict = get_openapi_fixture(path, method, name)
else:
fixture_dict = zerver.openapi.python_examples.FIXTURES[function]
path, method = function.rsplit(':', 1)
fixture_dict = get_openapi_fixture(path, method, name)
fixture_json = json.dumps(fixture_dict, indent=4, sort_keys=True,
separators=(',', ': '))