-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathrequest-responses.html
More file actions
42 lines (37 loc) · 2.07 KB
/
request-responses.html
File metadata and controls
42 lines (37 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<p class="responses-title"><strong>{{texts.responses}}</strong></p>
{% for code, definition in operation.responses.items() %}
=== "{% if code == "default" %}{{texts.other_responses}}{% else %}{{code}}{% with phrase = get_http_status_phrase(code) %}{% if phrase %} {{ phrase }}{% endif %}{% endwith %}{% endif %}"
{%- if is_reference(definition) -%}
{%- with type_name = definition["$ref"].replace("#/components/responses/", "") %}
<div class="common-response"><p>Refer to the common response description: <a href="#{{type_name.lower() | link}}" class="ref-link">{{type_name}}</a>.</p></div>
{%- endwith -%}
{%- endif -%}
{%- if definition.content %}
{%- with content = handler.simplify_content(definition.content) %}
{% for content_type, definition in content.items() %}
=== "{{content_type}}"
{% for example in handler.get_content_examples(definition) %}
{% if example.value %}
```json
{{handler.write_content_example(example, content_type) | indent(8) | safe}}
```
{% if example.auto_generated %}<span class="small-note">⚠️</span> <em class="small-note warning">{{texts.auto_generated_example_note}}</em>{% endif -%}
{% endif %}
{% endfor %}
{% if "alt_types" in definition %}<em class="small-note alt-types">{{texts.other_possible_types}}: {{definition.alt_types | join(", ")}}</em>{% endif %}
??? hint "{{texts.schema_of_the_response_body}}"
```json
{{handler.write_content_schema(definition) | indent(12) | safe}}
```
{% endfor %}
{% endwith -%}
{% endif -%}
{%- if definition.headers %}
**{{texts.response_headers}}**
| {{texts.name}} | {{texts.description}} | {{texts.schema}} |
| --- | --- | --- |
{%- for header_name, header_definition in handler.get_response_headers(definition).items() %}
| `{{header_name}}` | {{header_definition.description or ""}} | {%- with schema = header_definition.schema %}{%- include "partial/schema-repr.html" -%}{%- endwith %} |
{%- endfor %}
{% endif -%}
{%- endfor -%}