mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 00:18:12 +00:00
openapi: Make endpoint operationId dash-separated.
The operationId is directly used in URLs of API doc pages to find the OpenAPI data to render. However, this is dash- separated in the URLs, and having underscore_separated IDs in OpenAPI data doesn't allow direct comparison of the two. This commit changes all OperationIDs from underscore_separated to dash-separated.
This commit is contained in:
committed by
Tim Abbott
parent
644cd18dfd
commit
309f4ba145
@@ -92,9 +92,8 @@ class MarkdownDirectoryView(ApiURLView):
|
||||
article_path = os.path.join(settings.DEPLOY_ROOT, "templates") + path
|
||||
|
||||
if (not os.path.exists(article_path)) and self.path_template == "/zerver/api/%s.md":
|
||||
endpoint_path = article.replace("-", "_")
|
||||
try:
|
||||
endpoint_name, endpoint_method = get_endpoint_from_operationid(endpoint_path)
|
||||
endpoint_name, endpoint_method = get_endpoint_from_operationid(article)
|
||||
path = "/zerver/api/api-doc-template.md"
|
||||
except AssertionError:
|
||||
return DocumentationArticle(
|
||||
@@ -159,7 +158,7 @@ class MarkdownDirectoryView(ApiURLView):
|
||||
assert endpoint_method is not None
|
||||
article_title = get_openapi_summary(endpoint_name, endpoint_method)
|
||||
elif self.path_template == "/zerver/api/%s.md" and "{generate_api_title(" in first_line:
|
||||
api_operation = context["OPEN_GRAPH_URL"].split("/api/")[1].replace("-", "_")
|
||||
api_operation = context["OPEN_GRAPH_URL"].split("/api/")[1]
|
||||
endpoint_name, endpoint_method = get_endpoint_from_operationid(api_operation)
|
||||
article_title = get_openapi_summary(endpoint_name, endpoint_method)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user