Skip to content

Commit 8a00081

Browse files
committed
Add support for servers
1 parent 6188417 commit 8a00081

File tree

3 files changed

+24
-73
lines changed

3 files changed

+24
-73
lines changed

templates/markdown/.partials/info.md

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -3,75 +3,3 @@
33
## Terms of service
44
[{{openapi.info.termsOfService}}]({{openapi.info.termsOfService}})
55
{{/if}}
6-
7-
{{#if openapi.servers}}
8-
<a name="servers"></a>
9-
## Connection details
10-
11-
<table class="table">
12-
<thead class="table__head">
13-
<tr class="table__head__row">
14-
<th class="table__head__cell">URL</th>
15-
<th class="table__head__cell">Description</th>
16-
</tr>
17-
</thead>
18-
<tbody class="table__body">
19-
{{#each openapi.servers as |server|}}
20-
<tr class="table__body__row">
21-
<td class="table__body__cell">{{#if server.variables}}<div class="table__expand" data-index={{@index}}></div>{{/if}}{{server.url}}</td>
22-
<td class="table__body__cell">{{{server.description}}}</td>
23-
</tr>
24-
25-
{{#if server.variables}}
26-
<tr class="table__body__row--with-nested" data-nested-index={{@index}}>
27-
<td colspan="3">
28-
<details>
29-
<summary>Show more</summary>
30-
<table class="table table--nested">
31-
<thead class="table__head table--nested__head">
32-
<tr>
33-
<td class="table--nested__header" colspan="4">URL Variables</td>
34-
</tr>
35-
<tr class="table__head__row table--nested__head__row">
36-
<th class="table__head__cell table--nested__head__cell">Name</th>
37-
<th class="table__head__cell table--nested__head__cell">Default value</th>
38-
<th class="table__head__cell table--nested__head__cell">Possible values</th>
39-
<th class="table__head__cell table--nested__head__cell">Description</th>
40-
</tr>
41-
</thead>
42-
<tbody class="table__body table--nested__body">
43-
{{#each server.variables as |var|}}
44-
<tr class="table__body__row table--nested__body__row">
45-
<td class="table__body__cell table--nested__body__cell">{{@key}}</td>
46-
<td class="table__body__cell table--nested__body__cell">
47-
{{#if var.default}}
48-
{{var.default}}
49-
{{else}}
50-
<em>None</em>
51-
{{/if}}
52-
</td>
53-
<td class="table__body__cell table--nested__body__cell">
54-
{{#if var.enum}}
55-
<ul class="info__server__enum-list">
56-
{{#each var.enum as |value|}}
57-
<li>{{value}}</li>
58-
{{/each}}
59-
</ul>
60-
{{else}}
61-
Any
62-
{{/if}}
63-
</td>
64-
<td class="table__body__cell table--nested__body__cell">{{{var.description}}}</td>
65-
</tr>
66-
{{/each}}
67-
</tbody>
68-
</table>
69-
</details>
70-
</td>
71-
</tr>
72-
{{/if}}
73-
{{/each}}
74-
75-
</tbody>
76-
</table>
77-
{{/if}}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{#if openapi.servers}}
2+
<a id="servers" />
3+
## Servers
4+
5+
<table>
6+
<thead>
7+
<tr>
8+
<th>URL</th>
9+
<th>Description</th>
10+
<tr>
11+
</thead>
12+
<tbody>
13+
{{#each openapi.servers as |server|}}
14+
<tr>
15+
<td><a href="{{server.url}}" target="_blank">{{server.url}}</a></td>
16+
<td>{{{server.descriptionAsHTML}}}</td>
17+
</tr>
18+
{{/each}}
19+
</tbody>
20+
</table>
21+
{{/if}}

templates/markdown/openapi.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* [Terms of Service](#termsOfService)
99
{{/if}}
1010
{{#if openapi.servers}}
11-
* [Connection Details](#servers)
11+
* [Servers](#servers)
1212
{{/if}}
1313
{{#if openapi.paths}}
1414
* [Paths](#paths)
@@ -33,6 +33,8 @@
3333

3434
{{> info}}
3535

36+
{{> servers}}
37+
3638
{{> security}}
3739

3840
{{> paths }}

0 commit comments

Comments
 (0)