Skip to content

Instantly share code, notes, and snippets.

@abhay-kumar
Created December 4, 2019 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhay-kumar/f27ba56b5e5caa3d142cc91633e6ab80 to your computer and use it in GitHub Desktop.
Save abhay-kumar/f27ba56b5e5caa3d142cc91633e6ab80 to your computer and use it in GitHub Desktop.
{% if resource.methods | length %}
{% for endpoint in resource.methods %}
### {{ endpoint.displayName | default(resource.relativeUri) | capitalize }}
{{ endpoint.description }}
```
{{ endpoint.method | upper }} {{ resource.parentUrl }}{{ resource.relativeUri }}
```
{% if endpoint.allUriParameters | length %}
URI Parameters
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
{%- for param in endpoint.allUriParameters %}
| `{{ param.key }}` | {{ param.type }} | {{ 'yes' if param.required else 'no' }} | {{ param.description }} |
{%- endfor %}
{% endif %}
{% if endpoint.queryParameters | length %}
#### QueryString Parameters
| Attribute | Type | Required | Description | Example |
| --------- | ---- | -------- | ----------- | ------- |
{%- for param in endpoint.queryParameters %}
| `{{ param.key }}` | {{ param.type }} | {{ 'yes' if param.required else 'no' }} | {{ param.description }} | {{ param.examples }} |
{%- endfor %}
{% endif %}
{% if endpoint.body | length %}
{% if endpoint.body[0].properties %}
#### Request
| Name | Type | Required |
| ---- | ---- | -------- |
{%- for param in endpoint.body[0].properties %}
| {{ param.name }} | {{ param.type }} | {{ 'yes' if param.required else 'no' }} |
{%- endfor %}
{% endif %}
{% if endpoint.body[0].examples | length %}
##### Example
```
{{ endpoint.body[0].examples[0].structuredValue | dump(2) }}
```
{% endif %}
{% endif %}
{% if endpoint.responses %}
#### Responses
| Code | Description |
| ---- | ----------- |
{%- for response in endpoint.responses %}
| {{ response.code }} | {{ response.description }} |
{%- endfor %}
{%- for response in endpoint.responses %}
{% if response.body | length %}
{% if response.body[0].examples | length %}
##### {{ response.code }} Sample Response
```
{{ response.body[0].examples[0].structuredValue | dump(2) }}
```
{% endif %}
{% endif %}
{%- endfor %}
{% endif %}
---
{%- endfor -%}
{% endif %}
{% for resource in resource.resources %}
{% include "./resource.njk" %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment