OpenAPI spec parsing: add custom templates w/ warning

This commit is contained in:
mDuo13
2019-10-01 17:01:08 -07:00
parent f4d7460a26
commit c2d8cd7f5a
7 changed files with 276 additions and 23 deletions

View File

@@ -0,0 +1,51 @@
# {{info.title}} {{info.version}} Methods
{{info.description}}
**Warning:** {{spec.info.title}} is early alpha software. API methods and data formats are likely to change frequently in ways that break backwards compatibility.
{% if tags %}
View API methods by category:
{% for tag in tags %}
- [{{tag.name|title}} Methods](#{{slugify(tag.name)|lower}}-methods)
{% endfor %}
{% endif %}
{% for tag in tags %}
{% if endpoints_by_tag(tag.name)|list|length %}
## {{tag.name|title}} Methods
{{tag.description}}
| Summary | Path |
|:--------|:-----|
{%- set reflinks = [] -%}
{%- for path,method,endpoint in endpoints_by_tag(tag.name) %}
{%- set _ = reflinks.append("["+endpoint.summary+"]: "+method_link(path, method, endpoint) ) %}
| [{{endpoint.summary}}][] | [`{{method|upper}} {{path}}`][{{endpoint.summary}}] |
{%- endfor %}
{% for reflink in reflinks -%}
{{reflink}}
{% endfor %}
{% endif %}
{% endfor %}
{% if endpoints_by_tag("Uncategorized")|list|length %}
## Uncategorized Methods
| Name | Path | Summary |
|:-----|:-----|:--------|
{%- set reflinks = [] -%}
{%- for path,method,endpoint in endpoints_by_tag("Uncategorized") %}
{%- set _ = reflinks.append("["+endpoint.operationId+"]: "+method_link(path, method, endpoint) ) %}
| [{{endpoint.operationId}}][] | [`{{method|upper}} {{path}}`][{{endpoint.operationId}}] | {{endpoint.summary}} |
{%- endfor %}
{% for reflink in reflinks -%}
{{reflink}}
{% endfor %}
{% endif %}