nexmo-oas-renderer 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.env.example +1 -0
- data/.github/workflows/push-docker-publish.yml +19 -0
- data/.gitignore +6 -0
- data/.rspec +1 -0
- data/.rubocop.yml +135 -0
- data/.travis.yml +9 -0
- data/CHANGELOG.md +58 -0
- data/CONTRIBUTING.md +46 -0
- data/Dockerfile +6 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +248 -0
- data/LICENSE.txt +21 -0
- data/README.md +103 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/nexmo-oas-renderer +5 -0
- data/lib/nexmo/oas/engine.rb +11 -0
- data/lib/nexmo/oas/renderer.rb +13 -0
- data/lib/nexmo/oas/renderer/app.rb +201 -0
- data/lib/nexmo/oas/renderer/config.ru +9 -0
- data/lib/nexmo/oas/renderer/config/code_languages.yml +138 -0
- data/lib/nexmo/oas/renderer/config/dynamic_content.yml +1 -0
- data/lib/nexmo/oas/renderer/decorators/response_parser_decorator.rb +55 -0
- data/lib/nexmo/oas/renderer/helpers/navigation.rb +66 -0
- data/lib/nexmo/oas/renderer/helpers/render.rb +25 -0
- data/lib/nexmo/oas/renderer/helpers/summary.rb +33 -0
- data/lib/nexmo/oas/renderer/helpers/url.rb +19 -0
- data/lib/nexmo/oas/renderer/presenters/api_specification.rb +54 -0
- data/lib/nexmo/oas/renderer/presenters/endpoint.rb +21 -0
- data/lib/nexmo/oas/renderer/presenters/groups.rb +39 -0
- data/lib/nexmo/oas/renderer/presenters/navigation.rb +26 -0
- data/lib/nexmo/oas/renderer/presenters/open_api_specification.rb +62 -0
- data/lib/nexmo/oas/renderer/presenters/request_body_raw.rb +141 -0
- data/lib/nexmo/oas/renderer/presenters/response_format.rb +29 -0
- data/lib/nexmo/oas/renderer/presenters/response_tab/link.rb +36 -0
- data/lib/nexmo/oas/renderer/presenters/response_tab/panel.rb +45 -0
- data/lib/nexmo/oas/renderer/presenters/response_tabs.rb +58 -0
- data/lib/nexmo/oas/renderer/presenters/versions.rb +51 -0
- data/lib/nexmo/oas/renderer/public/500.html +66 -0
- data/lib/nexmo/oas/renderer/public/assets/images/brands/android.svg +1 -0
- data/lib/nexmo/oas/renderer/public/assets/images/brands/curl.svg +1 -0
- data/lib/nexmo/oas/renderer/public/assets/images/brands/dotnet.svg +1 -0
- data/lib/nexmo/oas/renderer/public/assets/images/brands/ios.svg +1 -0
- data/lib/nexmo/oas/renderer/public/assets/images/brands/java.svg +1 -0
- data/lib/nexmo/oas/renderer/public/assets/images/brands/javascript.svg +1 -0
- data/lib/nexmo/oas/renderer/public/assets/images/brands/node.svg +1 -0
- data/lib/nexmo/oas/renderer/public/assets/images/brands/php.svg +1 -0
- data/lib/nexmo/oas/renderer/public/assets/images/brands/python.svg +11 -0
- data/lib/nexmo/oas/renderer/public/assets/images/brands/ruby.svg +1 -0
- data/lib/nexmo/oas/renderer/public/assets/images/lost.svg +37 -0
- data/lib/nexmo/oas/renderer/public/assets/javascripts/components/format.js +47 -0
- data/lib/nexmo/oas/renderer/public/assets/javascripts/nexmo-oas-renderer.js +65 -0
- data/lib/nexmo/oas/renderer/public/assets/javascripts/popper.min.js +5 -0
- data/lib/nexmo/oas/renderer/public/assets/javascripts/prism.js +22 -0
- data/lib/nexmo/oas/renderer/public/assets/javascripts/tooltip.min.js +5 -0
- data/lib/nexmo/oas/renderer/public/assets/javascripts/volta.accordion.js +307 -0
- data/lib/nexmo/oas/renderer/public/assets/javascripts/volta.core.js +230 -0
- data/lib/nexmo/oas/renderer/public/assets/javascripts/volta.modal.js +300 -0
- data/lib/nexmo/oas/renderer/public/assets/javascripts/volta.tabs.js +143 -0
- data/lib/nexmo/oas/renderer/public/assets/javascripts/volta.tooltip.js +76 -0
- data/lib/nexmo/oas/renderer/public/assets/stylesheets/nexmo-oas-renderer.css +287 -0
- data/lib/nexmo/oas/renderer/public/assets/stylesheets/nexmo-oas-renderer.css.map +7 -0
- data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/api.scss +341 -0
- data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/mediaqueries.scss +48 -0
- data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/style.scss +6 -0
- data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/themes/dark.scss +89 -0
- data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/themes/light.scss +68 -0
- data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/variables.scss +91 -0
- data/lib/nexmo/oas/renderer/public/assets/stylesheets/volta-prism.min.css +1 -0
- data/lib/nexmo/oas/renderer/public/assets/stylesheets/volta.min.css +1 -0
- data/lib/nexmo/oas/renderer/public/assets/symbol/volta-icons.svg +1 -0
- data/lib/nexmo/oas/renderer/public/favicon.ico +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-Regular.eot +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-Regular.ttf +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-Regular.woff +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-Regular.woff2 +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiBold.eot +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiBold.ttf +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiBold.woff +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiBold.woff2 +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiMonoSemiBold.eot +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiMonoSemiBold.ttf +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiMonoSemiBold.woff +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiMonoSemiBold.woff2 +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-WideMedium.eot +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-WideMedium.ttf +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-WideMedium.woff +0 -0
- data/lib/nexmo/oas/renderer/public/fonts/Spezia-WideMedium.woff2 +0 -0
- data/lib/nexmo/oas/renderer/services/oas_parser.rb +23 -0
- data/lib/nexmo/oas/renderer/services/open_api_definition_resolver.rb +35 -0
- data/lib/nexmo/oas/renderer/version.rb +9 -0
- data/lib/nexmo/oas/renderer/views/api/index.erb +19 -0
- data/lib/nexmo/oas/renderer/views/api/show.erb +1 -0
- data/lib/nexmo/oas/renderer/views/concepts/list/plain.html.erb +5 -0
- data/lib/nexmo/oas/renderer/views/layouts/_head.erb +6 -0
- data/lib/nexmo/oas/renderer/views/layouts/_javascripts.erb +14 -0
- data/lib/nexmo/oas/renderer/views/layouts/api.erb +23 -0
- data/lib/nexmo/oas/renderer/views/layouts/open_api.erb +12 -0
- data/lib/nexmo/oas/renderer/views/open_api/_auth.erb +74 -0
- data/lib/nexmo/oas/renderer/views/open_api/_available_endpoints.erb +25 -0
- data/lib/nexmo/oas/renderer/views/open_api/_callback.erb +5 -0
- data/lib/nexmo/oas/renderer/views/open_api/_callback_endpoint.erb +38 -0
- data/lib/nexmo/oas/renderer/views/open_api/_callbacks.erb +5 -0
- data/lib/nexmo/oas/renderer/views/open_api/_code_examples.erb +16 -0
- data/lib/nexmo/oas/renderer/views/open_api/_endpoint.erb +54 -0
- data/lib/nexmo/oas/renderer/views/open_api/_header.erb +71 -0
- data/lib/nexmo/oas/renderer/views/open_api/_model.erb +43 -0
- data/lib/nexmo/oas/renderer/views/open_api/_navigation.erb +68 -0
- data/lib/nexmo/oas/renderer/views/open_api/_parameter_groups.erb +56 -0
- data/lib/nexmo/oas/renderer/views/open_api/_parameters.erb +115 -0
- data/lib/nexmo/oas/renderer/views/open_api/_request_json.erb +4 -0
- data/lib/nexmo/oas/renderer/views/open_api/_request_one_of.erb +70 -0
- data/lib/nexmo/oas/renderer/views/open_api/_request_single.erb +53 -0
- data/lib/nexmo/oas/renderer/views/open_api/_requests.erb +22 -0
- data/lib/nexmo/oas/renderer/views/open_api/_response_description_parameters.erb +130 -0
- data/lib/nexmo/oas/renderer/views/open_api/_response_descriptions.erb +45 -0
- data/lib/nexmo/oas/renderer/views/open_api/_response_fields.erb +3 -0
- data/lib/nexmo/oas/renderer/views/open_api/_response_tabs.erb +18 -0
- data/lib/nexmo/oas/renderer/views/open_api/_responses.erb +51 -0
- data/lib/nexmo/oas/renderer/views/open_api/_tabbed_parameters.erb +64 -0
- data/lib/nexmo/oas/renderer/views/open_api/_tabbed_single_parameter.erb +56 -0
- data/lib/nexmo/oas/renderer/views/open_api/_webhooks.erb +30 -0
- data/lib/nexmo/oas/renderer/views/open_api/show.erb +26 -0
- data/lib/nexmo/oas/renderer/views/static/404.erb +6 -0
- data/nexmo-oas-renderer.gemspec +51 -0
- metadata +397 -0
@@ -0,0 +1,5 @@
|
|
1
|
+
<ul class="Vlt-list Vlt-list--simple">
|
2
|
+
<% @concepts.each do |concept| %>
|
3
|
+
<li><a href="<%= concept.url %>"><%= concept.title %></a><% if concept.description %>: <%= concept.description.render_markdown.gsub(%r{^<p>},'').gsub(%r{^</p>}, '').strip %><% end %></li>
|
4
|
+
<% end %>
|
5
|
+
</ul>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<head>
|
2
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
3
|
+
<link rel="stylesheet" href="/assets/stylesheets/volta.min.css"/>
|
4
|
+
<link rel="stylesheet" href="/assets/stylesheets/volta-prism.min.css"/>
|
5
|
+
<link rel="stylesheet" href="/assets/stylesheets/nexmo-oas-renderer.css"/>
|
6
|
+
</head>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<script src="/assets/javascripts/prism.js"></script>
|
2
|
+
<script src="/assets/javascripts/popper.min.js"></script>
|
3
|
+
<script src="/assets/javascripts/tooltip.min.js"></script>
|
4
|
+
<script src="/assets/javascripts/volta.core.js"></script>
|
5
|
+
<script src="/assets/javascripts/volta.accordion.js"></script>
|
6
|
+
<script src="/assets/javascripts/volta.tabs.js"></script>
|
7
|
+
<script src="/assets/javascripts/volta.modal.js"></script>
|
8
|
+
<script src="/assets/javascripts/volta.tooltip.js"></script>
|
9
|
+
<script src="/assets/javascripts/nexmo-oas-renderer.js?a=1"></script>
|
10
|
+
<script src="/assets/javascripts/components/format.js"></script>
|
11
|
+
<script type="text/javascript">
|
12
|
+
Volta.init(["accordion", "tab", "modal", "tooltip"]);
|
13
|
+
new Format
|
14
|
+
</script>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<%= erb :'layouts/_head' %>
|
4
|
+
|
5
|
+
<body class="Nxd-template">
|
6
|
+
<nav class="Vlt-sidenav" id="Vlt-sidenav">
|
7
|
+
<div class="Vlt-sidenav__scroll">
|
8
|
+
<% begin %>
|
9
|
+
<%= erb :"layouts/#{@specification.side_navigation}" %>
|
10
|
+
<% rescue Errno::ENOENT %>
|
11
|
+
<%= @navigation.navigation_from_content %>
|
12
|
+
<% end %>
|
13
|
+
</div>
|
14
|
+
</nav>
|
15
|
+
<main class="Vlt-main Vlt-main--light Nxd-main" tabindex="2">
|
16
|
+
<div class="Vlt-card" id="primary-content">
|
17
|
+
<%= yield %>
|
18
|
+
</div>
|
19
|
+
</main>
|
20
|
+
|
21
|
+
<%= erb :"layouts/_javascripts" %>
|
22
|
+
</body>
|
23
|
+
</html>
|
@@ -0,0 +1,74 @@
|
|
1
|
+
<% if endpoint.jwt? || endpoint.basic_auth? || endpoint.oauth? %>
|
2
|
+
<h4>Authentication</h4>
|
3
|
+
|
4
|
+
<% if endpoint.jwt? && endpoint.basic_auth? %>
|
5
|
+
<p>This API supports both JWT and Basic authentication. Basic authentication is easier to get started with, but does not support advanced features such as ACLs.</p>
|
6
|
+
|
7
|
+
<p>You can use <em>either</em> JWT or Basic authentication, but not both at the same time.</p>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<div class="Vlt-table Vlt-table--bordered">
|
11
|
+
<table>
|
12
|
+
<thead>
|
13
|
+
<tr>
|
14
|
+
<th>Key</th>
|
15
|
+
<th>Description</th>
|
16
|
+
<th>Example</th>
|
17
|
+
<th>Default</th>
|
18
|
+
</tr>
|
19
|
+
</thead>
|
20
|
+
<tbody>
|
21
|
+
|
22
|
+
<% if endpoint.oauth? %>
|
23
|
+
<tr>
|
24
|
+
<td>
|
25
|
+
<b>Authorization</b>
|
26
|
+
</td>
|
27
|
+
<td>
|
28
|
+
<b>Your OAuth token.</b><br>
|
29
|
+
<small><a href="/vonage-business-cloud/vbc-apis/getting-started/authentication">Read more about OAuth tokens</a></small>
|
30
|
+
</td>
|
31
|
+
<td><code>Bearer <access_token></code></td>
|
32
|
+
<td>
|
33
|
+
<em>None</em>
|
34
|
+
</td>
|
35
|
+
</tr>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
<% if endpoint.jwt? %>
|
39
|
+
<tr>
|
40
|
+
<td>
|
41
|
+
<b>Authorization</b>
|
42
|
+
</td>
|
43
|
+
<td>
|
44
|
+
<b>Your JSON web token.</b><br>
|
45
|
+
<small><a href="/concepts/guides/authentication#json-web-tokens-jwt">Read more about JWTs</a></small>
|
46
|
+
</td>
|
47
|
+
<td><code>Bearer <JWT></code></td>
|
48
|
+
<td>
|
49
|
+
<em>None</em>
|
50
|
+
</td>
|
51
|
+
</tr>
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
<% if endpoint.basic_auth? %>
|
55
|
+
<tr>
|
56
|
+
<td>
|
57
|
+
<b>Authorization</b>
|
58
|
+
</td>
|
59
|
+
<td>
|
60
|
+
<b>Base64 encoded API key and secret joined by a colon.</b><br>
|
61
|
+
<small><a href="/concepts/guides/authentication#header-based-api-key-and-secret-authentication">Read more</a></small>
|
62
|
+
</td>
|
63
|
+
<td><code>Basic <base64></code></td>
|
64
|
+
<td>
|
65
|
+
<i>None</i>
|
66
|
+
</td>
|
67
|
+
</tr>
|
68
|
+
<% end %>
|
69
|
+
|
70
|
+
</tbody>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<% end %>
|
74
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h5>Available Operations:</h5>
|
2
|
+
<ul>
|
3
|
+
<% endpoints.each do |endpoint| %>
|
4
|
+
<li>
|
5
|
+
<span style="width: 58px; text-align:center; margin-right:4px;" class="Vlt-badge Vlt-badge--margin-left Nxd-method-badge Nxd-method-badge--<%= endpoint.method %> Vlt-badge--small"><%= endpoint.method %></span>
|
6
|
+
<a href="#<%= endpoint.operationId %>"><%= normalize_summary_title(endpoint.summary, endpoint.operationId) %></a>
|
7
|
+
</li>
|
8
|
+
|
9
|
+
<% if endpoint.callbacks.any? %>
|
10
|
+
<% endpoint.callbacks.each do |callback| %>
|
11
|
+
<% callback.paths.each do |path| %>
|
12
|
+
<% path.endpoints.each do |endpoint| %>
|
13
|
+
<li style="margin-top: 8px;">
|
14
|
+
<span style="margin-left:24px; margin-right: 4px;">
|
15
|
+
<svg style="width: 12px; height:12px;" class="Vlt-black"><use xlink:href="/assets/symbol/volta-icons.svg#Vlt-icon-toggle" /></svg>
|
16
|
+
</span>
|
17
|
+
<a href="#<%= endpoint.operationId %>"><%= normalize_summary_title(endpoint.summary, endpoint.operationId) %></a>
|
18
|
+
</li>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
24
|
+
</ul>
|
25
|
+
<br />
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<div class="Vlt-grid">
|
2
|
+
<div class="Vlt-col oas-left-panel" style="padding-bottom: 36px;">
|
3
|
+
<h3 id="<%= endpoint.operationId %>" class="Vlt-title--icon">
|
4
|
+
<%= endpoint.summary %>
|
5
|
+
<% if webhook %>
|
6
|
+
<span class="Vlt-badge Vlt-badge--orange">
|
7
|
+
<i class="icon icon-webhook"></i> Webhook
|
8
|
+
</span>
|
9
|
+
<% else %>
|
10
|
+
<span class="Vlt-badge Vlt-badge--green">
|
11
|
+
<i class="icon icon-callback"></i> Callback
|
12
|
+
</span>
|
13
|
+
<% end %>
|
14
|
+
</h3>
|
15
|
+
<% if endpoint.description %>
|
16
|
+
<p><%= endpoint.description.render_markdown %></p>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<div class="Vlt-badge-combined">
|
20
|
+
<code class="Vlt-badge Vlt-badge--large Nxd-method-badge Nxd-method-badge--<%= endpoint.method %>"><%= endpoint.method.upcase %></code>
|
21
|
+
<code class="Vlt-badge Vlt-badge--large Vlt-bg-grey-lighter Vlt-black">
|
22
|
+
<span class="api-path-host">https://example.com</span><%= (endpoint.raw['x-example-path'] || '/webhooks/event').gsub(/\{(.+?)\}/, '<span class="api-path-parameter">:\1</span>') %>
|
23
|
+
</code>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<%= erb :'open_api/_parameter_groups', locals: { endpoint: endpoint, callback: true } %>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div class="Vlt-col oas-right-panel">
|
30
|
+
|
31
|
+
<% endpoint.request_body.formats.each_with_index do |format, index| %>
|
32
|
+
<div class="js-format" data-format="<%= format %>">
|
33
|
+
<%= erb :'open_api/_requests', locals: { endpoint: endpoint, title: "Example Payload" } %>
|
34
|
+
</div>
|
35
|
+
<% end %>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%
|
2
|
+
# @todo Re-enable code examples once we decide how to handle them in OAS
|
3
|
+
false && if endpoint.raw['x-code-example-path']
|
4
|
+
%>
|
5
|
+
<h5>Example request</h5>
|
6
|
+
<%=
|
7
|
+
markdown = <<~HEREDOC
|
8
|
+
```tabbed_examples
|
9
|
+
config: #{endpoint.raw['x-code-example-path']}
|
10
|
+
```
|
11
|
+
HEREDOC
|
12
|
+
|
13
|
+
markdown.render_markdown
|
14
|
+
%>
|
15
|
+
<% end %>
|
16
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<div class="Vlt-grid">
|
2
|
+
<div class="Vlt-col oas-left-panel" style="padding-bottom: 36px;">
|
3
|
+
|
4
|
+
<h3 id='<%= endpoint.operationId %>'><%= endpoint.summary %></h3>
|
5
|
+
<% if endpoint.description %>
|
6
|
+
<p><%= endpoint.description.render_markdown %></p>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<% servers = endpoint.path.servers ? endpoint.path.servers : endpoint.definition.servers %>
|
10
|
+
<% raise "`servers` parameter not provided at either the path level or document root" unless servers.size.positive? %>
|
11
|
+
|
12
|
+
<%
|
13
|
+
path = endpoint.path.path.gsub(/\{(.+?)\}/, ':\1').chomp("/")
|
14
|
+
uri = URI("#{servers[0]['url']}#{path}")
|
15
|
+
%>
|
16
|
+
<div class="oas-path-full Vlt-badge-combined">
|
17
|
+
<code class="Vlt-badge Vlt-badge--large Nxd-method-badge Nxd-method-badge--<%= endpoint.method %>"><%= endpoint.method.upcase %></code>
|
18
|
+
<code class="Vlt-badge Vlt-badge--large Vlt-bg-grey-lighter Vlt-black">
|
19
|
+
<span><%= uri.scheme %>://<%= uri.host %></span><%= uri.path.gsub(/:([^\/]+)/, '<span class="api-path-parameter">:\1</span>') %>
|
20
|
+
</code>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="oas-path-small Vlt-badge-combined" style="margin-bottom: 8px;">
|
24
|
+
<code class="Vlt-badge Vlt-badge--large">Host</code>
|
25
|
+
<code class="Vlt-badge Vlt-badge--large Vlt-bg-grey-lighter Vlt-black">
|
26
|
+
<%= uri.scheme %>://<%= uri.host %>
|
27
|
+
</code>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<div class="oas-path-small Vlt-badge-combined">
|
31
|
+
<code class="Vlt-badge Vlt-badge--large Nxd-method-badge Nxd-method-badge--<%= endpoint.method %>"><%= endpoint.method.upcase %></code>
|
32
|
+
<code class="Vlt-badge Vlt-badge--large Vlt-bg-grey-lighter Vlt-black">
|
33
|
+
<%= uri.path.gsub(/:([^\/]+)/, '<span class="api-path-parameter">:\1</span>') %>
|
34
|
+
</code>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<%= erb :'open_api/_auth', locals: { endpoint: endpoint } %>
|
38
|
+
|
39
|
+
<%= erb :'open_api/_parameter_groups', locals: { endpoint: endpoint } %>
|
40
|
+
|
41
|
+
<%= erb :'open_api/_response_descriptions', locals: { endpoint: endpoint, auto_expand_responses: @auto_expand_responses } %>
|
42
|
+
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div class="Vlt-col oas-right-panel">
|
46
|
+
|
47
|
+
<%= erb :'open_api/_requests', locals: { endpoint: endpoint } %>
|
48
|
+
|
49
|
+
<%= erb :'open_api/_responses', locals: { endpoint: endpoint } %>
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
</div>
|
54
|
+
</div>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<div class="Vlt-grid">
|
2
|
+
<div class="Vlt-col oas-left-panel header-row" style="padding-top:20px;">
|
3
|
+
<a href="<%= @theme_link %>" class="Vlt-switch Vlt-switch--secondary" style="float:right;">
|
4
|
+
<span class="Vlt-switch__slider"></span>
|
5
|
+
</a>
|
6
|
+
|
7
|
+
|
8
|
+
<div class="Nxd-api__title">
|
9
|
+
<h1>
|
10
|
+
<%= definition.info['title'] %>
|
11
|
+
</h1>
|
12
|
+
<% if definition.info['x-label'] %>
|
13
|
+
<div>
|
14
|
+
<span class="Vlt-badge Vlt-badge--<%= definition.info['x-label'].parameterize %>">
|
15
|
+
<%= definition.info['x-label'] %>
|
16
|
+
</span>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<% if definition.info['description'] %>
|
22
|
+
<p><%= definition.info['description'].render_markdown %></p>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<div class="Vlt-grid">
|
26
|
+
<div class="Vlt-col">
|
27
|
+
<a href=<%= url("#{request.path}.#{definition.format}") %> class='Vlt-btn Vlt-btn--secondary Vlt-btn--app'>
|
28
|
+
<svg><use xlink:href="/assets/symbol/volta-icons.svg#Vlt-icon-download" /></svg>
|
29
|
+
Download OAS 3 Definition
|
30
|
+
</a>
|
31
|
+
</div>
|
32
|
+
<div class="Vlt-col Vlt-right Vlt-right-sm">
|
33
|
+
<a href="<%= Nexmo::OAS::Renderer::API.github_path %>/<%= @specification.definition_name %>.yml" class='Vlt-btn Vlt-btn--tertiary Vlt-btn--app Vlt-right Vlt-bg-grey-lighter'>
|
34
|
+
<svg className="Vlt-icon Vlt-black">
|
35
|
+
<use xlink:href="/assets/symbol/volta-icons.svg#Vlt-icon-github" />
|
36
|
+
</svg>
|
37
|
+
Improve this specification
|
38
|
+
</a>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<%
|
43
|
+
# If there's only one group, everything is untagged
|
44
|
+
if @specification.groups.size === 1
|
45
|
+
%>
|
46
|
+
<%= erb :'open_api/_available_endpoints', locals: { endpoints: definition.endpoints } %>
|
47
|
+
<% end %>
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<%
|
52
|
+
has_switcher = @specification.available_versions && @specification.available_versions.count > 1
|
53
|
+
%>
|
54
|
+
|
55
|
+
<div class="oas-right-panel Vlt-col <%= has_switcher ? '' : 'sm-hidden' %>">
|
56
|
+
|
57
|
+
<% if has_switcher %>
|
58
|
+
<div class="Vlt-callout Vlt-callout--shoutout Nxd-version">
|
59
|
+
<i></i>
|
60
|
+
<div class="Vlt-callout__content">
|
61
|
+
<h4>There are multiple versions of this API available</h4>
|
62
|
+
<p>
|
63
|
+
<% @specification.available_versions.each do |v| %>
|
64
|
+
<a href="/api/<%= v['name'] %>" <%= v['version'] == @specification.current_version ? 'class=active':'' %>>Version <%= v['version'] %></a> <%= '|' unless v == @specification.available_versions.last %>
|
65
|
+
<% end %>
|
66
|
+
</p>
|
67
|
+
</div>
|
68
|
+
</div>
|
69
|
+
<% end %>
|
70
|
+
</div>
|
71
|
+
</div>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<div class="Vlt-grid">
|
2
|
+
<div class="Vlt-col oas-left-panel">
|
3
|
+
|
4
|
+
<h2 id="<%= group['name'].parameterize %>" class='Vlt-grey-dark group-header'><%= group['name'] %></h2>
|
5
|
+
<p class="Vlt-grey-darker"><%= group['description']&.render_markdown %></p>
|
6
|
+
|
7
|
+
|
8
|
+
<%= erb :'open_api/_available_endpoints', locals: { endpoints: endpoints } %>
|
9
|
+
|
10
|
+
<% if group['schema'] %>
|
11
|
+
<% group['schema'].each do |format, schema| %>
|
12
|
+
<div class="js-format" data-format="<%= format %>">
|
13
|
+
<%
|
14
|
+
if schema['properties']
|
15
|
+
properties = schema['properties']
|
16
|
+
elsif schema['allOf']
|
17
|
+
properties = schema['allOf'].map { |o| o['properties'] }.reduce(&:merge)
|
18
|
+
end
|
19
|
+
|
20
|
+
properties = properties.map do |name, definition|
|
21
|
+
OasParser::Property.new(self, schema, name, definition)
|
22
|
+
end
|
23
|
+
%>
|
24
|
+
|
25
|
+
<%= erb :'open_api/_parameters', locals: { parameters: properties, model: true, format: format } %>
|
26
|
+
</div>
|
27
|
+
<% end %>
|
28
|
+
<% end %>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div class="Vlt-col oas-right-panel <%= !group['schema'] ? 'sm-hidden' : '' %>">
|
32
|
+
|
33
|
+
<% if group['schema'] %>
|
34
|
+
<% group['schema'].each do |format, schema| %>
|
35
|
+
<div class="js-format" data-format="<%= format %>">
|
36
|
+
<h5>Example Model</h5>
|
37
|
+
<%= ResponseParserDecorator.new(schema).html(format, xml_options: schema['xml']) %>
|
38
|
+
</div>
|
39
|
+
<% end %>
|
40
|
+
<% end %>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
</div>
|
@@ -0,0 +1,68 @@
|
|
1
|
+
<header class="oas-navbar oas-navbar-full">
|
2
|
+
<% if @specification.groups.size == 1 %>
|
3
|
+
<a href="#top" class="Vlt-btn Vlt-btn--tertiary group-link">Available Operations</a>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
|
7
|
+
<% @specification.groups.each do |name, endpoints| %>
|
8
|
+
<% next unless name %>
|
9
|
+
<a href="#<%= name.parameterize %>" class="Vlt-btn Vlt-btn--tertiary group-link"><%= name %></a>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<% if @specification.definition.raw['x-webhooks'] || definition.webhooks.size.positive? %>
|
13
|
+
<a href="#webhooks" class="Vlt-btn Vlt-btn--tertiary group-link">Webhooks</a>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
|
17
|
+
<% if @specification.formats.size > 1 %>
|
18
|
+
<div class="Vlt-native-dropdown">
|
19
|
+
<select class="js-format-selector">
|
20
|
+
<% @specification.formats.each do |value, name| %>
|
21
|
+
<option value="<%= value %>"><%= name %> Responses</option>
|
22
|
+
<% end %>
|
23
|
+
</select>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
26
|
+
</header>
|
27
|
+
|
28
|
+
<header class="oas-navbar oas-navbar-small">
|
29
|
+
<div id="oas-nav-accordion" style="width: 100%;">
|
30
|
+
<span role="link" class="oas-trigger">
|
31
|
+
<% if @specification.formats.size > 1 %>
|
32
|
+
<div class="Vlt-native-dropdown">
|
33
|
+
<select class="js-format-selector">
|
34
|
+
<% @specification.formats.each do |value, name| %>
|
35
|
+
<option value="<%= value %>"><%= name %> Responses</option>
|
36
|
+
<% end %>
|
37
|
+
</select>
|
38
|
+
</div>
|
39
|
+
<% end %>
|
40
|
+
</span>
|
41
|
+
|
42
|
+
<div class="oas-trigger-content">
|
43
|
+
<% if @specification.groups.size == 1 %>
|
44
|
+
<a href="#top" class="Vlt-btn Vlt-btn--tertiary group-link">Available Operations</a>
|
45
|
+
<% end %>
|
46
|
+
|
47
|
+
<br />
|
48
|
+
<br />
|
49
|
+
|
50
|
+
<% has_webhooks = @specification.definition.raw['x-webhooks'] || definition.webhooks.size.positive? %>
|
51
|
+
<% if @specification.groups.size > 1 || has_webhooks %>
|
52
|
+
<h4>Endpoints</h4>
|
53
|
+
|
54
|
+
<% @specification.groups.each do |name, endpoints| %>
|
55
|
+
<% next unless name %>
|
56
|
+
<a href="#<%= name.parameterize %>" class="Vlt-btn Vlt-btn--tertiary group-link"><%= name %></a>
|
57
|
+
<% end %>
|
58
|
+
<% end %>
|
59
|
+
|
60
|
+
<% if has_webhooks %>
|
61
|
+
<a href="#webhooks" class="Vlt-btn Vlt-btn--tertiary group-link">Webhooks</a>
|
62
|
+
<% end %>
|
63
|
+
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
</header>
|
67
|
+
|
68
|
+
<span id="top"></span>
|