nexmo-oas-renderer 2.0.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +8 -8
- data/lib/nexmo/oas/renderer/presenters/api_specification.rb +10 -2
- data/lib/nexmo/oas/renderer/public/assets/javascripts/nexmo-oas-renderer.js +17 -8
- data/lib/nexmo/oas/renderer/version.rb +1 -1
- data/lib/nexmo/oas/renderer/views/open_api/_endpoint.erb +1 -1
- data/lib/nexmo/oas/renderer/views/open_api/_errors.erb +34 -0
- data/lib/nexmo/oas/renderer/views/open_api/_navigation.erb +7 -0
- data/lib/nexmo/oas/renderer/views/open_api/_parameter_groups.erb +1 -8
- data/lib/nexmo/oas/renderer/views/open_api/_parameters.erb +4 -4
- data/lib/nexmo/oas/renderer/views/open_api/_response_descriptions.erb +15 -0
- data/lib/nexmo/oas/renderer/views/open_api/_responses.erb +18 -2
- data/lib/nexmo/oas/renderer/views/open_api/show.erb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a463231ba72ba74bc9a6555449eb2d2cba6155c32a2506235b04b8bf332678b
|
4
|
+
data.tar.gz: 9c8ed923712ff7e677c6f36b532e77fb41ef6120057d52635f7b1a892102aacc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3e4c30d89a5cc22fd66491751235b49d4b56a5a63ce8e9a3d303e8c4989f5e3a47cc8964c5d78b6cc4f1d33467e1ca83065a00e399fcfc076607a81633b7c3e
|
7
|
+
data.tar.gz: df6590d1e2de8eb3771dcec2c0cf3617a7453e81e83a34318989d2f42d0513032dfd5c4a35ea3f991a8d1785f6871f6b800e5fb79a863f4c8890ebff89cd2754
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nexmo-oas-renderer (2.0
|
4
|
+
nexmo-oas-renderer (2.2.0)
|
5
5
|
activemodel (~> 6.0)
|
6
6
|
activesupport (~> 6.0)
|
7
7
|
banzai (~> 0.1.2)
|
@@ -82,7 +82,7 @@ GEM
|
|
82
82
|
crass (1.0.6)
|
83
83
|
deep_merge (1.2.1)
|
84
84
|
diff-lcs (1.4.2)
|
85
|
-
dotenv (2.7.
|
85
|
+
dotenv (2.7.6)
|
86
86
|
erubi (1.9.0)
|
87
87
|
ffi (1.13.1)
|
88
88
|
globalid (0.4.2)
|
@@ -109,7 +109,7 @@ GEM
|
|
109
109
|
hansi (~> 0.2.0)
|
110
110
|
mustermann (= 1.1.1)
|
111
111
|
neatjson (0.9)
|
112
|
-
nexmo_markdown_renderer (0.4.
|
112
|
+
nexmo_markdown_renderer (0.4.1)
|
113
113
|
activemodel (~> 6.0)
|
114
114
|
banzai (~> 0.1.2)
|
115
115
|
i18n (~> 1.7)
|
@@ -136,9 +136,9 @@ GEM
|
|
136
136
|
parallel (1.19.2)
|
137
137
|
parser (2.7.1.4)
|
138
138
|
ast (~> 2.4.1)
|
139
|
-
public_suffix (4.0.
|
139
|
+
public_suffix (4.0.6)
|
140
140
|
rack (2.2.3)
|
141
|
-
rack-protection (2.0
|
141
|
+
rack-protection (2.1.0)
|
142
142
|
rack
|
143
143
|
rack-test (1.1.0)
|
144
144
|
rack (>= 1.0, < 3)
|
@@ -210,10 +210,10 @@ GEM
|
|
210
210
|
rb-inotify (~> 0.9, >= 0.9.7)
|
211
211
|
shotgun (0.9.2)
|
212
212
|
rack (>= 1.0)
|
213
|
-
sinatra (2.0
|
213
|
+
sinatra (2.1.0)
|
214
214
|
mustermann (~> 1.0)
|
215
|
-
rack (~> 2.
|
216
|
-
rack-protection (= 2.0
|
215
|
+
rack (~> 2.2)
|
216
|
+
rack-protection (= 2.1.0)
|
217
217
|
tilt (~> 2.0)
|
218
218
|
sprockets (4.0.2)
|
219
219
|
concurrent-ruby (~> 1.0)
|
@@ -11,11 +11,19 @@ module Nexmo
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def side_navigation
|
14
|
-
|
14
|
+
if defined?(NexmoDeveloper::Application)
|
15
|
+
"#{Rails.configuration.docs_base_path}/api/#{@document_name}"
|
16
|
+
else
|
17
|
+
"api/#{@document_name}"
|
18
|
+
end
|
15
19
|
end
|
16
20
|
|
17
21
|
def document_path
|
18
|
-
|
22
|
+
if defined?(NexmoDeveloper::Application)
|
23
|
+
"#{Rails.configuration.docs_base_path}/_api/#{@document_name}.md"
|
24
|
+
else
|
25
|
+
"_api/#{@document_name}.md"
|
26
|
+
end
|
19
27
|
end
|
20
28
|
|
21
29
|
def document
|
@@ -1,11 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
if
|
4
|
-
|
1
|
+
document.addEventListener("DOMContentLoaded", function() {
|
2
|
+
// Only run this JS on OAS pages
|
3
|
+
if(!document.querySelector(".oas-wrapper")){
|
4
|
+
return;
|
5
|
+
}
|
6
|
+
|
7
|
+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
8
|
+
var queryString = new URLSearchParams(window.location.search);
|
9
|
+
if (!queryString.get('theme')) {
|
10
|
+
queryString.set("theme", "dark");
|
11
|
+
window.location.search = queryString.toString();
|
12
|
+
}
|
5
13
|
}
|
6
|
-
}
|
7
14
|
|
8
|
-
document.addEventListener("DOMContentLoaded", function() {
|
9
15
|
// Handle people clicking on oneOf tabs by changing every one on the page
|
10
16
|
var oneOfTabs = document.querySelectorAll('[data-tab-link]');
|
11
17
|
Array.from(oneOfTabs).forEach(function (element) {
|
@@ -33,7 +39,10 @@ document.addEventListener("DOMContentLoaded", function() {
|
|
33
39
|
}
|
34
40
|
c.style.display = c.style.display == 'block' ? 'none' : "block";
|
35
41
|
};
|
36
|
-
|
42
|
+
|
43
|
+
if (document.querySelector('.oas-trigger')) {
|
44
|
+
document.querySelector('.oas-trigger').addEventListener("click", toggleTopNav);
|
45
|
+
}
|
37
46
|
|
38
47
|
document.querySelectorAll('a').forEach((element) => {
|
39
48
|
var href = element.getAttribute("href");
|
@@ -54,5 +63,5 @@ document.addEventListener("DOMContentLoaded", function() {
|
|
54
63
|
|
55
64
|
});
|
56
65
|
});
|
57
|
-
|
58
66
|
});
|
67
|
+
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<% raise "`servers` parameter not provided at either the path level or document root" unless servers.size.positive? %>
|
11
11
|
|
12
12
|
<%
|
13
|
-
path = endpoint.path.path.gsub(/\{(.+?)\}/, ':\1')
|
13
|
+
path = endpoint.path.path.gsub(/\{(.+?)\}/, ':\1').chomp("/")
|
14
14
|
uri = URI("#{servers[0]['url']}#{path}")
|
15
15
|
%>
|
16
16
|
<div class="oas-path-full Vlt-badge-combined">
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<% if definition.raw['x-errors'] %>
|
2
|
+
<div>
|
3
|
+
<div class="Vlt-grid">
|
4
|
+
<div class="Vlt-col oas-left-panel" style="padding-bottom: 36px;">
|
5
|
+
<h2 id="errors">Errors</h2>
|
6
|
+
<p>
|
7
|
+
The following is a non-exhaustive list of error codes that may occur while using this API. These codes are in addition to any of our <a href="/api-errors">generic error codes</a>.
|
8
|
+
</p>
|
9
|
+
</div>
|
10
|
+
<div class="Vlt-col oas-right-panel"></div>
|
11
|
+
</div>
|
12
|
+
<div class="Vlt-grid">
|
13
|
+
<div class="Vlt-col Vlt-table oas-left-panel">
|
14
|
+
<table>
|
15
|
+
<thead>
|
16
|
+
<tr>
|
17
|
+
<th>Code</th>
|
18
|
+
<th>Details</th>
|
19
|
+
</tr>
|
20
|
+
</thead>
|
21
|
+
<tbody>
|
22
|
+
<% definition.raw['x-errors'].each do |name, body| %>
|
23
|
+
<tr>
|
24
|
+
<td><a href="/api-errors/<%= @specification.definition_name %>#<%= name %>"><b><%= name %></b></a></td>
|
25
|
+
<td><%= body['description'].render_markdown %> </td>
|
26
|
+
</tr>
|
27
|
+
<% end %>
|
28
|
+
</tbody>
|
29
|
+
</table>
|
30
|
+
</div>
|
31
|
+
<div class="Vlt-col oas-right-panel"></div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
@@ -13,6 +13,9 @@
|
|
13
13
|
<a href="#webhooks" class="Vlt-btn Vlt-btn--tertiary group-link">Webhooks</a>
|
14
14
|
<% end %>
|
15
15
|
|
16
|
+
<% if definition.raw['x-errors'] %>
|
17
|
+
<a href="#errors" class="Vlt-btn Vlt-btn--tertiary group-link">Errors</a>
|
18
|
+
<% end %>
|
16
19
|
|
17
20
|
<% if @specification.formats.size > 1 %>
|
18
21
|
<div class="Vlt-native-dropdown">
|
@@ -44,6 +47,10 @@
|
|
44
47
|
<a href="#top" class="Vlt-btn Vlt-btn--tertiary group-link">Available Operations</a>
|
45
48
|
<% end %>
|
46
49
|
|
50
|
+
<% if definition.raw['x-errors'] %>
|
51
|
+
<a href="#errors" class="Vlt-btn Vlt-btn--tertiary group-link">Errors</a>
|
52
|
+
<% end %>
|
53
|
+
|
47
54
|
<br />
|
48
55
|
<br />
|
49
56
|
|
@@ -29,14 +29,7 @@
|
|
29
29
|
<% unless endpoint.request_body.exhibits_one_of_multiple_schemas?(format) %>
|
30
30
|
|
31
31
|
<%
|
32
|
-
|
33
|
-
# We probably want real allOf support in OasParser, but that's more time than I have right now
|
34
|
-
allOf = endpoint.request_body.content[format]['schema']['allOf']
|
35
|
-
if allOf
|
36
|
-
params = endpoint.request_body.handle_all_of(allOf)
|
37
|
-
else
|
38
|
-
params = endpoint.request_body.properties_for_format(format)
|
39
|
-
end
|
32
|
+
params = endpoint.request_body.properties_for_format(format)
|
40
33
|
if params
|
41
34
|
%>
|
42
35
|
|
@@ -59,11 +59,11 @@
|
|
59
59
|
<span class="constraint">Required</span>
|
60
60
|
<% end %>
|
61
61
|
|
62
|
-
<% if parameter.minimum %>
|
63
|
-
| <span class="constraint">Min:</span> <%= parameter.minimum %>
|
62
|
+
<% if parameter.minimum || parameter.raw['minLength'] %>
|
63
|
+
| <span class="constraint">Min:</span> <%= parameter.minimum || parameter.raw['minLength'] %>
|
64
64
|
<% end %>
|
65
|
-
<% if parameter.maximum %>
|
66
|
-
| <span class="constraint">Max:</span> <%= parameter.maximum %>
|
65
|
+
<% if parameter.maximum || parameter.raw['maxLength'] %>
|
66
|
+
| <span class="constraint">Max:</span> <%= parameter.maximum || parameter.raw['maxLength'] %>
|
67
67
|
<% end %>
|
68
68
|
</div>
|
69
69
|
|
@@ -17,7 +17,11 @@
|
|
17
17
|
</div>
|
18
18
|
|
19
19
|
<div id="acc<%= id %>" class="Vlt-js-accordion__content <%= @specification.auto_expand_responses ? 'Vlt-js-accordion__content_open' : '' %>">
|
20
|
+
<% missing = @specification.formats.keys %>
|
21
|
+
|
20
22
|
<% response.formats.each_with_index do |format, index| %>
|
23
|
+
<% missing.delete(format) %>
|
24
|
+
|
21
25
|
<% if response.exhibits_one_of_multiple_schemas?(format) %>
|
22
26
|
<%= erb :'open_api/_response_tabs', locals: { endpoint: endpoint, format: format, response: response, content: :descriptions } %>
|
23
27
|
<% else %>
|
@@ -25,6 +29,17 @@
|
|
25
29
|
<%= erb :'open_api/_response_fields', locals: { endpoint: endpoint, schema: schema, format: format, index: nil } %>
|
26
30
|
<% end %>
|
27
31
|
<% end %>
|
32
|
+
|
33
|
+
<% missing.each do |format| %>
|
34
|
+
<div class="js-format Nxd-api__response" data-format="<%= format %>">
|
35
|
+
<div class="Vlt-callout Vlt-callout--warning" style="margin-top: 8px;">
|
36
|
+
<i></i>
|
37
|
+
<div class="Vlt-callout__content">
|
38
|
+
<p>This endpoint does not support <code><%= format %></code></p>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
<% end %>
|
28
43
|
</div>
|
29
44
|
</div>
|
30
45
|
<% end %>
|
@@ -9,7 +9,11 @@
|
|
9
9
|
<div id="response-tabs-<%= endpoint.operationId.parameterize %>" style="margin-bottom: 64px;">
|
10
10
|
<% endpoint.responses.each_with_index do |response, index| %>
|
11
11
|
<div class="Vlt-js-tabs__panel <%= index === 0 ? 'Vlt-js-tabs__panel_active' : '' %>">
|
12
|
+
|
13
|
+
<% missing = @specification.formats.keys %>
|
14
|
+
|
12
15
|
<% response.formats.each do |format| %>
|
16
|
+
<% missing.delete(format) %>
|
13
17
|
<div class="js-format" data-format="<%= format %>">
|
14
18
|
<% if response.exhibits_one_of_multiple_schemas?(format) %>
|
15
19
|
<%= erb :'open_api/_response_tabs', locals: { format: format, endpoint: endpoint, response: response, content: :responses } %>
|
@@ -25,11 +29,23 @@
|
|
25
29
|
</div>
|
26
30
|
<% end %>
|
27
31
|
|
28
|
-
<% if response.code == '204'
|
32
|
+
<% if response.code == '204' %>
|
29
33
|
<% content = response.description ? response.description : 'No content' %>
|
30
34
|
<pre class="language-json Vlt-prism--copy-disabled <%= @theme_light ? 'Vlt-prism--dark' : '' %>"><code><%= content %></code></pre>
|
35
|
+
<% else %>
|
36
|
+
<% missing.each do |format| %>
|
37
|
+
<div class="js-format Nxd-api__response" data-format="<%= format %>">
|
38
|
+
<div class="Vlt-callout Vlt-callout--warning">
|
39
|
+
<i></i>
|
40
|
+
<div class="Vlt-callout__content">
|
41
|
+
<p>This endpoint does not support <code><%= format %></code></p>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
<% end %>
|
31
46
|
<% end %>
|
32
|
-
|
47
|
+
|
48
|
+
</div>
|
33
49
|
|
34
50
|
<% end %>
|
35
51
|
</div>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexmo-oas-renderer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabian Rodriguez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -348,6 +348,7 @@ files:
|
|
348
348
|
- lib/nexmo/oas/renderer/views/open_api/_callbacks.erb
|
349
349
|
- lib/nexmo/oas/renderer/views/open_api/_code_examples.erb
|
350
350
|
- lib/nexmo/oas/renderer/views/open_api/_endpoint.erb
|
351
|
+
- lib/nexmo/oas/renderer/views/open_api/_errors.erb
|
351
352
|
- lib/nexmo/oas/renderer/views/open_api/_header.erb
|
352
353
|
- lib/nexmo/oas/renderer/views/open_api/_model.erb
|
353
354
|
- lib/nexmo/oas/renderer/views/open_api/_navigation.erb
|
@@ -389,8 +390,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
389
390
|
- !ruby/object:Gem::Version
|
390
391
|
version: '0'
|
391
392
|
requirements: []
|
392
|
-
|
393
|
-
rubygems_version: 2.7.6.2
|
393
|
+
rubygems_version: 3.1.4
|
394
394
|
signing_key:
|
395
395
|
specification_version: 4
|
396
396
|
summary: OpenAPI Specification renderer.
|