oas_rails 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fdf9973a8c14f6808ef6369e2fdaf1a54bdc2194e5c09ccf2e9609892023a3f7
4
- data.tar.gz: 1098d9e9c65ec23087457adafc46cbb39de47e329041a07606141ccc1edf649f
3
+ metadata.gz: 5b7344f0f77c27f3d15b8ba5030664685973d74faa4ff2d23821967c66d0495b
4
+ data.tar.gz: c22ebcb019a8071cd89abf80a6170d45e451b9c2e24645f7f958d498b2b390ed
5
5
  SHA512:
6
- metadata.gz: 80a3d2a75ace97f2676ddaf97c8e354d6404f09ec494cbe01cbde26071741e67754730f2681b56b9aeb49778b34cad276cc89aaa1c48a94b509f203051f44421
7
- data.tar.gz: 071e435e34fd6b37711a9bf1a010686c58a672e8b1256a36cbac78279f5a4bc805fe1f59e33b43efc3ec825a54bf9fd74251b421ca561a25b2b3345e8dc23146
6
+ metadata.gz: 580e32391f327d90e64bb504976a974971b2acdb6cd93a4a5a18efcb4d9f6395c5371522aa3db2e81d95ca4fa2b3fc24f4e4cd8f46b1e15228d934aae3366a2d
7
+ data.tar.gz: 18d129900f968958d2b76e1ede4ec650e91f8a8678fe52a94a1c30ec74904e3c4c6d736c0fd8a83c8dae2eea08736e1de7eefebe40b793530a43f727fb8cb35e
@@ -1,4 +1,21 @@
1
1
  module OasRails
2
2
  module OasRailsHelper
3
+ def rapidoc_configuration_attributes
4
+ {
5
+ "spec-url" => "#{OasRails::Engine.routes.find_script_name({})}.json",
6
+ "show-header" => "false",
7
+ "font-size" => "largest",
8
+ "show-method-in-nav-bar" => "as-colored-text",
9
+ "nav-item-spacing" => "relaxed",
10
+ "allow-spec-file-download" => "true",
11
+ "schema-style" => "table",
12
+ "sort-tags" => "true",
13
+ "persist-auth" => "true"
14
+ }.merge(OasRails.config.rapidoc_configuration).map { |k, v| %(#{k}=#{ERB::Util.html_escape(v)}) }.join(' ')
15
+ end
16
+
17
+ def rapidoc_logo_url
18
+ OasRails.config.rapidoc_logo_url
19
+ end
3
20
  end
4
21
  end
@@ -125,17 +125,13 @@
125
125
  </script>
126
126
  </head>
127
127
  <body>
128
- <rapi-doc
129
- spec-url="<%= OasRails::Engine.routes.find_script_name({}) %>.json"
130
- show-header="false"
131
- font-size="largest"
132
- show-method-in-nav-bar="as-colored-text"
133
- nav-item-spacing="relaxed"
134
- allow-spec-file-download="true"
135
- schema-style="table"
136
- sort-tags="true"
137
- persist-auth="true"
138
- >
128
+ <rapi-doc <%= rapidoc_configuration_attributes %> >
129
+ <% if rapidoc_logo_url %>
130
+ <img
131
+ slot="nav-logo"
132
+ src="<%= rapidoc_logo_url %>"
133
+ />
134
+ <% end %>
139
135
  </rapi-doc>
140
136
 
141
137
  <style>
@@ -70,6 +70,14 @@ OasRails.configure do |config|
70
70
  # Default: false
71
71
  # config.layout = "application"
72
72
 
73
+ # Override general rapi-doc settings
74
+ # config.rapidoc_configuration
75
+ # default: {}
76
+
77
+ # Add a logo to rapi-doc
78
+ # config.rapidoc_logo_url
79
+ # default: nil
80
+
73
81
  # Excluding custom controllers or controllers#action
74
82
  # Example: ["projects", "users#new"]
75
83
  # config.ignored_actions = []
@@ -1,6 +1,6 @@
1
1
  module OasRails
2
2
  class Configuration < OasCore::Configuration
3
- attr_accessor :autodiscover_request_body, :autodiscover_responses, :ignored_actions, :rapidoc_theme, :layout, :source_oas_path
3
+ attr_accessor :autodiscover_request_body, :autodiscover_responses, :ignored_actions, :rapidoc_theme, :layout, :source_oas_path, :rapidoc_configuration, :rapidoc_logo_url
4
4
  attr_reader :route_extractor, :include_mode
5
5
 
6
6
  def initialize
@@ -12,6 +12,8 @@ module OasRails
12
12
  @ignored_actions = []
13
13
  @rapidoc_theme = :rails
14
14
  @layout = nil
15
+ @rapidoc_configuration = {}
16
+ @rapidoc_logo_url = nil
15
17
  @source_oas_path = nil
16
18
 
17
19
  # TODO: implement
@@ -1,3 +1,3 @@
1
1
  module OasRails
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oas_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - a-chacon