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:
Suyash Vardhan Mathur
2021-07-09 19:39:32 +05:30
committed by Tim Abbott
parent 644cd18dfd
commit 309f4ba145
4 changed files with 72 additions and 75 deletions

View File

@@ -62,9 +62,7 @@ def test_generated_curl_examples_for_success(client: Client) -> None:
# deleted and its page is generated by the
# template. Thus, the curl example would just
# a single one following the template's pattern.
endpoint_path, endpoint_method = get_endpoint_from_operationid(
endpoint.replace("-", "_")
)
endpoint_path, endpoint_method = get_endpoint_from_operationid(endpoint)
endpoint_string = endpoint_path + ":" + endpoint_method
command = f"{{generate_code_example(curl)|{endpoint_string}|example}}"
curl_commands_to_test.append(command)