nexmo-oas-renderer 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/nexmo/oas/renderer/presenters/api_specification.rb +10 -2
- data/lib/nexmo/oas/renderer/public/assets/javascripts/nexmo-oas-renderer.js +47 -40
- 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/_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 +16 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b5e0e8b5fa6f2398fce6e27b89653e00b1b6cf7b2fc0b89b00e466c59ff7010
|
4
|
+
data.tar.gz: 899fd7a44676aef146f525466edb0bf0bcccd49accd2d4ebb04f21fb06f2318f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dea762339636ed621dbf8b44267fb6eeee6be97d8f20be236193ff2d8bdfc9e432cca22ec30ed150fa78c8f97d9e318ecc3ab1263c23f47bb54601f65edee995
|
7
|
+
data.tar.gz: 8decb45d42b106fc52bc46e9f4575f2b58f4273e7d425ff9478259cb0c1ffd4603156957998abbb15d94515060f05e96a52960051dffc59610df8048ffd59dee
|
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.1.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)
|
@@ -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,58 +1,65 @@
|
|
1
|
-
if
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
if(document.querySelector(".oas-wrapper")){
|
2
|
+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
3
|
+
var queryString = new URLSearchParams(window.location.search);
|
4
|
+
if (!queryString.get('theme')) {
|
5
|
+
queryString.set("theme", "dark");
|
6
|
+
window.location.search = queryString.toString();
|
7
|
+
}
|
5
8
|
}
|
6
|
-
}
|
7
9
|
|
8
|
-
document.addEventListener("DOMContentLoaded", function() {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
document.addEventListener("DOMContentLoaded", function() {
|
11
|
+
// Handle people clicking on oneOf tabs by changing every one on the page
|
12
|
+
var oneOfTabs = document.querySelectorAll('[data-tab-link]');
|
13
|
+
Array.from(oneOfTabs).forEach(function (element) {
|
14
|
+
element.addEventListener('click', function (event) {
|
15
|
+
var link = event.target.getAttribute('data-tab-link');
|
16
|
+
var matchingTabs = document.querySelectorAll('[data-tab-link="' + link + '"]');
|
17
|
+
Array.from(matchingTabs).forEach(function (element) {
|
18
|
+
element.dispatchEvent(new Event('toggle'));
|
19
|
+
});
|
17
20
|
});
|
18
21
|
});
|
19
|
-
});
|
20
22
|
|
21
|
-
|
23
|
+
var toggleTopNav = function(event, closeOnly) {
|
24
|
+
|
25
|
+
if (event) {
|
26
|
+
if (!Array.from(event.target.classList).includes("oas-trigger")) {
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
}
|
22
30
|
|
23
|
-
|
24
|
-
if (
|
31
|
+
var c = document.querySelector('.oas-trigger-content');
|
32
|
+
if (closeOnly === true) {
|
33
|
+
c.style.display = "none";
|
25
34
|
return;
|
26
35
|
}
|
27
|
-
|
36
|
+
c.style.display = c.style.display == 'block' ? 'none' : "block";
|
37
|
+
};
|
28
38
|
|
29
|
-
|
30
|
-
|
31
|
-
c.style.display = "none";
|
32
|
-
return;
|
39
|
+
if (document.querySelector('.oas-trigger')) {
|
40
|
+
document.querySelector('.oas-trigger').addEventListener("click", toggleTopNav);
|
33
41
|
}
|
34
|
-
c.style.display = c.style.display == 'block' ? 'none' : "block";
|
35
|
-
};
|
36
|
-
document.querySelector('.oas-trigger').addEventListener("click", toggleTopNav);
|
37
42
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
43
|
+
document.querySelectorAll('a').forEach((element) => {
|
44
|
+
var href = element.getAttribute("href");
|
45
|
+
if (!href){ return; }
|
46
|
+
if (href.slice(0,1) !== "#"){ return; }
|
47
|
+
element.addEventListener('click', function (event) {
|
48
|
+
event.preventDefault();
|
44
49
|
|
45
|
-
|
50
|
+
toggleTopNav(null, true);
|
46
51
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
52
|
+
var to = document.querySelector(event.target.hash)
|
53
|
+
history.pushState({}, '', event.target.href);
|
54
|
+
window.scrollTo({
|
55
|
+
top: (window.scrollY + to.getBoundingClientRect().y) - 70,
|
56
|
+
left: 0,
|
57
|
+
})
|
53
58
|
|
54
59
|
|
60
|
+
});
|
55
61
|
});
|
62
|
+
|
56
63
|
});
|
64
|
+
}
|
57
65
|
|
58
|
-
});
|
@@ -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">
|
@@ -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,7 +29,18 @@
|
|
25
29
|
</div>
|
26
30
|
<% end %>
|
27
31
|
|
28
|
-
<%
|
32
|
+
<% missing.each do |format| %>
|
33
|
+
<div class="js-format Nxd-api__response" data-format="<%= format %>">
|
34
|
+
<div class="Vlt-callout Vlt-callout--warning">
|
35
|
+
<i></i>
|
36
|
+
<div class="Vlt-callout__content">
|
37
|
+
<p>This endpoint does not support <code><%= format %></code></p>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
<% end %>
|
42
|
+
|
43
|
+
<% if response.code == '204' %>
|
29
44
|
<% content = response.description ? response.description : 'No content' %>
|
30
45
|
<pre class="language-json Vlt-prism--copy-disabled <%= @theme_light ? 'Vlt-prism--dark' : '' %>"><code><%= content %></code></pre>
|
31
46
|
<% end %>
|
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.1.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-07-
|
11
|
+
date: 2020-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|