-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtemplate.html
55 lines (52 loc) · 1.54 KB
/
template.html
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
43
44
45
46
47
48
49
50
51
52
53
54
55
<div class="swagger">
<h2><%= api.info.title %></h2>
<h6><%= api.info.description %></h6>
<ul>
<%
var row = 'even';
for (var path in api.paths) {
var methods = api.paths[path];
for (var method in methods) {
var endpoint = methods[method];
row = (row == 'even') ? 'odd' : 'even';
%>
<li class="<%= row %>">
<h3 class="summary"><%= endpoint.summary %></h3>
<h4 class="path"><span class="method <%= method %>"><%= method.toUpperCase() %></span><%= path %></h4>
<p><%= endpoint.description %></p>
<% if (endpoint.consumes && endpoint.consumes.legnth) { %>
<p>Accepts: <%= endpoint.consumes.join(', ')%> | Produces: <%= endpoint.produces.join(', ') %></p>
<% } %>
<h5>Parameters</h5>
<% if (endpoint.parameters.length) { %>
<ul>
<%
for (var i = 0; i < endpoint.parameters.length; i++) {
var parameter = endpoint.parameters[i];
%>
<li><%= parameter.name %></li>
<% } %>
</ul>
<% } else { %>
<p>There are no parameters</p>
<% } %>
<h5>Responses</h5>
<% if (endpoint.responses.length) { %>
<ul>
<%
for (var code in endpoint.responses) {
var response = endpoint.responses[code];
%>
<li>
<p><%= code %> <%= response.description %></p>
</li>
<% } %>
</ul>
<% } else { %>
<p>There are no responses</p>
<% } %>
</li>
<% } %>
<% } %>
</ul>
</div>