Add ability to refer to aliases of endpoints

pull/977/head
Daniel Wagner-Hall 9 years ago
parent 96a77d7449
commit 26ebe3e68b

@ -1,5 +1,10 @@
``{{endpoint.method}} {{endpoint.path}}``
{{(5 + (endpoint.path | length) + (endpoint.method | length)) * title_kind}}
{% if "alias_for_path" in endpoint -%}
``{{endpoint.path}}`` is an alias for `{{endpoint.alias_for_path}}`_.
.. _`{{endpoint.alias_for_path}}`: #{{endpoint.alias_link}}
{% else -%}
{{endpoint.desc | wrap(80)}}
@ -62,3 +67,4 @@ Example::
{{res["example"] | indent_block(2)}}
{% endfor %}
{% endif -%}

@ -105,11 +105,24 @@ class MatrixUnits(Units):
for path in api["paths"]:
for method in api["paths"][path]:
single_api = api["paths"][path][method]
full_path = api.get("basePath", "") + path
alias_for_path = single_api.get("x-alias-for-path", "")
alias_link = single_api.get("x-alias-link", "")
if alias_for_path:
endpoints.append({
"method": method.upper(),
"path": full_path,
"alias_for_path": alias_for_path,
"alias_link": alias_link
})
continue
endpoint = {
"title": single_api.get("summary", ""),
"desc": single_api.get("description", single_api.get("summary", "")),
"method": method.upper(),
"path": api.get("basePath", "") + path,
"path": full_path,
"requires_auth": "security" in single_api,
"rate_limited": 429 in single_api.get("responses", {}),
"req_params": [],

Loading…
Cancel
Save