nexmo-oas-renderer 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +4 -3
- data/lib/nexmo/oas/renderer/presenters/response_tab/panel.rb +3 -1
- data/lib/nexmo/oas/renderer/presenters/response_tabs.rb +4 -2
- 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/_response_description_parameters.erb +86 -24
- data/lib/nexmo/oas/renderer/views/open_api/_response_descriptions.erb +4 -4
- data/lib/nexmo/oas/renderer/views/open_api/_response_fields.erb +1 -1
- data/lib/nexmo/oas/renderer/views/open_api/_response_tabs.erb +1 -1
- data/nexmo-oas-renderer.gemspec +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: dd8d4b2e48a2f59827cedcc768e575bfd2c3cb017a956fda2f1229737c56ffe0
|
4
|
+
data.tar.gz: 40cd40d5fca9582ea435fb73046f147275f98d0c2e97f9c9d842afe27a5a4472
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28e38f0b3ee339407c713b27479973be7ddd5e298a4a71a4910ca5e51ffee8d75ca579903941662cf2d7114543be2f9f51016e67f3028ae14c59bbadfd0a83d2
|
7
|
+
data.tar.gz: d9bac1035bda4b54418617e29c626b2efa39410cc772eab34faa5a719abee6864d2ca753af0225fd01df4925606e30c612c763a90d17bb56af5be7b00941c2b0
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nexmo-oas-renderer (0.5.
|
4
|
+
nexmo-oas-renderer (0.5.2)
|
5
5
|
activemodel (~> 5.2)
|
6
6
|
activesupport (~> 5.2)
|
7
7
|
banzai (~> 0.1.2)
|
8
8
|
dotenv (~> 2.7)
|
9
9
|
neatjson (~> 0.8)
|
10
|
-
oas_parser (= 0.
|
10
|
+
oas_parser (= 0.22.1)
|
11
11
|
octicons_helper (~> 8.2)
|
12
12
|
redcarpet (= 3.4.0)
|
13
13
|
rouge (= 2.0.7)
|
@@ -97,7 +97,7 @@ GEM
|
|
97
97
|
nio4r (2.5.1)
|
98
98
|
nokogiri (1.10.4)
|
99
99
|
mini_portile2 (~> 2.4.0)
|
100
|
-
oas_parser (0.
|
100
|
+
oas_parser (0.22.1)
|
101
101
|
activesupport (>= 4.0.0)
|
102
102
|
addressable (~> 2.3)
|
103
103
|
builder (~> 3.2.3)
|
@@ -193,6 +193,7 @@ PLATFORMS
|
|
193
193
|
DEPENDENCIES
|
194
194
|
bundler (~> 2.0)
|
195
195
|
nexmo-oas-renderer!
|
196
|
+
rails (< 6.0.0)
|
196
197
|
rake (~> 10.0)
|
197
198
|
rspec (~> 3.8)
|
198
199
|
|
@@ -6,11 +6,12 @@ module Nexmo
|
|
6
6
|
class Panel
|
7
7
|
attr_reader :index
|
8
8
|
|
9
|
-
def initialize(schema:, index:, format:, content:)
|
9
|
+
def initialize(schema:, index:, format:, content:, endpoint:)
|
10
10
|
@schema = schema
|
11
11
|
@index = index
|
12
12
|
@format = format
|
13
13
|
@content = content
|
14
|
+
@endpoint = endpoint
|
14
15
|
end
|
15
16
|
|
16
17
|
def css_classes
|
@@ -29,6 +30,7 @@ module Nexmo
|
|
29
30
|
schema: @schema,
|
30
31
|
index: @index,
|
31
32
|
format: @format,
|
33
|
+
endpoint: @endpoint
|
32
34
|
}]
|
33
35
|
end
|
34
36
|
end
|
@@ -8,10 +8,11 @@ module Nexmo
|
|
8
8
|
class ResponseTabs
|
9
9
|
attr_reader :format
|
10
10
|
|
11
|
-
def initialize(format, response, content)
|
11
|
+
def initialize(format, response, content, endpoint)
|
12
12
|
@format = format
|
13
13
|
@response = response
|
14
14
|
@content = content
|
15
|
+
@endpoint = endpoint
|
15
16
|
end
|
16
17
|
|
17
18
|
def tab_links
|
@@ -29,7 +30,8 @@ module Nexmo
|
|
29
30
|
schema: schema,
|
30
31
|
index: index,
|
31
32
|
format: @format,
|
32
|
-
content: @content
|
33
|
+
content: @content,
|
34
|
+
endpoint: @endpoint
|
33
35
|
)
|
34
36
|
end
|
35
37
|
end
|
@@ -114,7 +114,7 @@
|
|
114
114
|
<% response.formats.each_with_index do |format, index| %>
|
115
115
|
<div class="js-format" data-format="<%= format %>">
|
116
116
|
<% if response.exhibits_one_of_multiple_schemas?(format) %>
|
117
|
-
<%= erb :'open_api/_response_tabs', locals: { format: format, response: response, content: :responses } %>
|
117
|
+
<%= erb :'open_api/_response_tabs', locals: { format: format, endpoint: endpoint, response: response, content: :responses } %>
|
118
118
|
<% else %>
|
119
119
|
<% schema = response.schema(format) %>
|
120
120
|
<%= Nexmo::OAS::Renderer::ResponseParserDecorator.new(schema).html(format, xml_options: schema['xml']) %>
|
@@ -14,9 +14,13 @@
|
|
14
14
|
|
15
15
|
<% if schema['properties'] %>
|
16
16
|
<% schema['properties'].each do |key, value| %>
|
17
|
-
<%
|
18
|
-
|
19
|
-
|
17
|
+
<%
|
18
|
+
next if key == '_links'
|
19
|
+
next if value['x-skip-response-description']
|
20
|
+
parent = "#{endpoint.method}_#{endpoint.path.path.gsub("/", "_")[1..-1]}" unless parent
|
21
|
+
responseFieldId = parent + "_" + key
|
22
|
+
%>
|
23
|
+
<tr id="<%= responseFieldId %>" <% if value['properties'] %> class=" Vlt-table__row--noline" <% end %>>
|
20
24
|
<td>
|
21
25
|
<b><%= key %></b>
|
22
26
|
<% if value['items'] %>
|
@@ -37,29 +41,87 @@
|
|
37
41
|
</small>
|
38
42
|
<% end %>
|
39
43
|
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
40
48
|
<% if value['items'] # If this is an array, we need to show the structure of the children %>
|
41
|
-
|
42
|
-
|
43
|
-
|
49
|
+
|
50
|
+
<% if value['items']['oneOf'] || value['items']['anyOf'] # If it's a oneOf/anyOf, we need tabs! %>
|
51
|
+
<%
|
52
|
+
|
53
|
+
if value['items']['oneOf']
|
54
|
+
qualifier = 'one'
|
55
|
+
key = 'oneOf'
|
56
|
+
else
|
57
|
+
qualifier = 'any'
|
58
|
+
key = 'anyOf'
|
59
|
+
end
|
60
|
+
|
61
|
+
schemas = value['items'][key].map do |item|
|
62
|
+
if item['allOf']
|
63
|
+
item = item.deep_merge(item['allOf'].reduce { |a,b| a.deep_merge(b) })
|
64
|
+
item.delete('allOf')
|
65
|
+
end
|
66
|
+
item
|
67
|
+
end
|
68
|
+
%>
|
69
|
+
<% else %>
|
70
|
+
<% value['properties'] = value['items']['properties'] %>
|
71
|
+
<% schemas = [value] %>
|
72
|
+
<% end %>
|
73
|
+
|
74
|
+
<% if schemas %>
|
75
|
+
<% needs_tabs = schemas.size > 1 %>
|
44
76
|
</td>
|
45
|
-
|
46
|
-
|
47
|
-
<
|
48
|
-
<
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
77
|
+
</tr>
|
78
|
+
|
79
|
+
<tr class="Vlt-table__row--nohighlight">
|
80
|
+
<td colspan="2">
|
81
|
+
|
82
|
+
<% if needs_tabs %>
|
83
|
+
<div class="Vlt-callout Vlt-callout--shoutout">
|
84
|
+
<i></i>
|
85
|
+
<div class="Vlt-callout__content">
|
86
|
+
This array contains <strong><%= qualifier %></strong> of the following objects:
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
<div class="Vlt-tabs js-format">
|
90
|
+
<div class="Vlt-tabs__header" role="tablist" aria-label="Responses">
|
91
|
+
<% schemas.each_with_index do |schema, index| %>
|
92
|
+
<div class="Vlt-tabs__link <%= index == 0 ? 'Vlt-tabs__link_active' : '' %>">
|
93
|
+
<%= schema['description'] %>
|
94
|
+
</div>
|
95
|
+
<% end %>
|
96
|
+
</div>
|
97
|
+
<div class="Vlt-tabs__content">
|
98
|
+
<% end %>
|
99
|
+
|
100
|
+
<% schemas.each_with_index do |value, index| %>
|
101
|
+
<div class="Vlt-tabs__panel <%= index == 0 ? 'Vlt-tabs__panel_active' : '' %>">
|
102
|
+
<div class="Vlt-table Vlt-table--data Vlt-table--bordered">
|
103
|
+
<table>
|
104
|
+
<thead>
|
105
|
+
<tr>
|
106
|
+
<th>Field</th>
|
107
|
+
<th>Description</th>
|
108
|
+
</tr>
|
109
|
+
</thead>
|
110
|
+
<tbody>
|
111
|
+
<%= erb :'open_api/_response_description_parameters', locals: { endpoint: endpoint, schema: value, parent: responseFieldId } %>
|
112
|
+
</tbody>
|
113
|
+
</table>
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
<% end %>
|
117
|
+
|
118
|
+
<% if needs_tabs %>
|
119
|
+
</div>
|
120
|
+
</div>
|
121
|
+
<% end %>
|
122
|
+
<% end %>
|
61
123
|
<% end %>
|
62
|
-
|
63
|
-
|
124
|
+
</td>
|
125
|
+
</tr>
|
64
126
|
<% end %>
|
65
127
|
<% end %>
|
@@ -6,19 +6,19 @@
|
|
6
6
|
<p class="collapsible">
|
7
7
|
<a class="Vlt-js-accordion__trigger Nxd-accordion-button" data-accordion="acc<%= id %>">
|
8
8
|
<span class="response-description-toggle Vlt-btn Vlt-btn--tertiary Vlt-btn--block">
|
9
|
-
<%= auto_expand_responses ? 'Hide' : 'View' %> response field descriptions
|
9
|
+
<%= @specification.auto_expand_responses ? 'Hide' : 'View' %> response field descriptions
|
10
10
|
</span>
|
11
11
|
</a>
|
12
12
|
</p>
|
13
13
|
|
14
|
-
<div id="acc<%= id %>" class="Vlt-js-accordion__content <%= auto_expand_responses ? 'Vlt-js-accordion__content_open' : '' %>">
|
14
|
+
<div id="acc<%= id %>" class="Vlt-js-accordion__content <%= @specification.auto_expand_responses ? 'Vlt-js-accordion__content_open' : '' %>">
|
15
15
|
<h4>Response Fields</h4>
|
16
16
|
<% response.formats.each_with_index do |format, index| %>
|
17
17
|
<% if response.exhibits_one_of_multiple_schemas?(format) %>
|
18
|
-
<%= erb :'open_api/_response_tabs', locals: { format: format, response: response, content: :descriptions } %>
|
18
|
+
<%= erb :'open_api/_response_tabs', locals: { endpoint: endpoint, format: format, response: response, content: :descriptions } %>
|
19
19
|
<% else %>
|
20
20
|
<% schema = response.schema(format) %>
|
21
|
-
<%= erb :'open_api/_response_fields', locals: { schema: schema, format: format, index: nil } %>
|
21
|
+
<%= erb :'open_api/_response_fields', locals: { endpoint: endpoint, schema: schema, format: format, index: nil } %>
|
22
22
|
<% end %>
|
23
23
|
<% end %>
|
24
24
|
</div>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
</tr>
|
12
12
|
</thead>
|
13
13
|
<tbody>
|
14
|
-
<%= erb :'open_api/_response_description_parameters', locals: { schema: schema } %>
|
14
|
+
<%= erb :'open_api/_response_description_parameters', locals: { response: response, endpoint: endpoint, schema: schema } %>
|
15
15
|
</tbody>
|
16
16
|
</table>
|
17
17
|
</div>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% tabs = Nexmo::OAS::Renderer::Presenters::ResponseTabs.new(format, response, content) %>
|
1
|
+
<% tabs = Nexmo::OAS::Renderer::Presenters::ResponseTabs.new(format, response, content, endpoint) %>
|
2
2
|
|
3
3
|
<div class='Vlt-tabs js-format' data-format='<%= tabs.format %>'>
|
4
4
|
<div class='Vlt-tabs__header' role='tablist' aria-label='Responses'>
|
data/nexmo-oas-renderer.gemspec
CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_runtime_dependency 'sinatra', '~> 2.0'
|
35
35
|
spec.add_runtime_dependency 'shotgun', '~> 0.9'
|
36
36
|
spec.add_runtime_dependency 'rouge', '2.0.7'
|
37
|
-
spec.add_runtime_dependency 'oas_parser', '0.
|
37
|
+
spec.add_runtime_dependency 'oas_parser', '0.22.1'
|
38
38
|
spec.add_runtime_dependency 'neatjson', '~> 0.8'
|
39
39
|
spec.add_runtime_dependency 'activesupport', '~> 5.2'
|
40
40
|
spec.add_runtime_dependency 'banzai', '~> 0.1.2'
|
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: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabian Rodriguez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.22.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.22.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: neatjson
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|