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}}`` ``{{endpoint.method}} {{endpoint.path}}``
{{(5 + (endpoint.path | length) + (endpoint.method | length)) * title_kind}} {{(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)}} {{endpoint.desc | wrap(80)}}
@ -62,3 +67,4 @@ Example::
{{res["example"] | indent_block(2)}} {{res["example"] | indent_block(2)}}
{% endfor %} {% endfor %}
{% endif -%}

@ -105,11 +105,24 @@ class MatrixUnits(Units):
for path in api["paths"]: for path in api["paths"]:
for method in api["paths"][path]: for method in api["paths"][path]:
single_api = api["paths"][path][method] 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 = { endpoint = {
"title": single_api.get("summary", ""), "title": single_api.get("summary", ""),
"desc": single_api.get("description", single_api.get("summary", "")), "desc": single_api.get("description", single_api.get("summary", "")),
"method": method.upper(), "method": method.upper(),
"path": api.get("basePath", "") + path, "path": full_path,
"requires_auth": "security" in single_api, "requires_auth": "security" in single_api,
"rate_limited": 429 in single_api.get("responses", {}), "rate_limited": 429 in single_api.get("responses", {}),
"req_params": [], "req_params": [],

Loading…
Cancel
Save