grape-swagger-rails 1.0.4 → 1.0.5

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: 8cc39abcbbeb304658e33061d3a5a9bbf258a66beda61047a24a57890a97b793
4
- data.tar.gz: ce8b864b428f69c0cfcad9219543706bcac89ed627fcfec85bd188546d57b726
3
+ metadata.gz: 5ecb777e34a30ebdb4040894ad38bfa90b3b3bd9ba2c66a5908b832e57b17af0
4
+ data.tar.gz: 667fc390286949f8f2db1553c8ba92e39f1ef8737bbd4421d86ebed064b5086b
5
5
  SHA512:
6
- metadata.gz: '042399acc3c5a99da72fe96ec25de18d787de3c37882aa27bd4b7fc6d59b49ad4a1517b995514f2f01c7e47667e66678a371ac6a981ccfedbc2138d46023c939'
7
- data.tar.gz: c4b12262becdb63a781acc27f2fad7396d7929843b8062069fe2e7aa4b632ad783138f2d8b16da55d283d7f822536f586f0213adb111329cc9f7ceba866dad3e
6
+ metadata.gz: 8fcd7a5f9ac2c84c712ae75e6fa7f569fc5b889af24c476709cc2181719d9c4cbfe25361549bfb1aa66e5f75584283de78ba356a1cbe272fe9d667b23abd6529
7
+ data.tar.gz: 51fc985776d938a1af472acea0e0b1d18d495db5c47378bbf3bdddf3dc2c592459cad5b75d19ad262ad63aced12494211395c51dba7d8fb7db04f72dc275414b
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  * Your contribution here.
4
4
 
5
+ ### 1.0.5 (2026/07/16)
6
+
7
+ * [#170](https://github.com/ruby-grape/grape-swagger-rails/pull/170): Enhance dark mode styling and improve api key documentation in swagger ui - [@moskvin](https://github.com/moskvin).
8
+
5
9
  ### 1.0.4 (2026/07/03)
6
10
 
7
11
  * [#169](https://github.com/ruby-grape/grape-swagger-rails/pull/169): Bump swagger ui to 5.32.8 - [@moskvin](https://github.com/moskvin).
@@ -157,6 +157,17 @@ html[data-theme="dark"] .swagger-select option {
157
157
  display: none;
158
158
  }
159
159
 
160
+ .swagger-ui .btn.authorize {
161
+ display: inline-flex;
162
+ align-items: center;
163
+ gap: 6px;
164
+ }
165
+
166
+ .swagger-ui .btn.authorize span {
167
+ float: none;
168
+ padding: 0;
169
+ }
170
+
160
171
  html[data-hide-api-key="true"] .swagger-auth {
161
172
  display: none;
162
173
  }
@@ -191,9 +202,38 @@ html[data-theme="dark"] .swagger-ui .responses-inner,
191
202
  html[data-theme="dark"] .swagger-ui .opblock .opblock-section-header,
192
203
  html[data-theme="dark"] .swagger-ui .opblock-body pre,
193
204
  html[data-theme="dark"] .swagger-ui .highlight-code,
194
- html[data-theme="dark"] .swagger-ui .microlight,
205
+ html[data-theme="dark"] .swagger-ui .microlight {
206
+ background: #0f172a;
207
+ color: #e2e8f0;
208
+ }
209
+
210
+ .swagger-ui .markdown,
211
+ .swagger-ui .renderedMarkdown {
212
+ line-height: 1.2em;
213
+ }
214
+
215
+ .swagger-ui .markdown code,
216
+ .swagger-ui .renderedMarkdown code {
217
+ padding: 2px 5px;
218
+ font-size: 1em;
219
+ }
220
+
195
221
  html[data-theme="dark"] .swagger-ui .renderedMarkdown code,
196
- html[data-theme="dark"] .swagger-ui .renderedMarkdown pre {
222
+ html[data-theme="dark"] .swagger-ui .markdown code {
223
+ background: #0f172a;
224
+ color: #c4b5fd;
225
+ }
226
+
227
+ html[data-theme="dark"] .swagger-ui .renderedMarkdown pre > code,
228
+ html[data-theme="dark"] .swagger-ui .markdown pre > code {
229
+ display: block;
230
+ background: transparent;
231
+ color: inherit;
232
+ padding: 0;
233
+ }
234
+
235
+ html[data-theme="dark"] .swagger-ui .renderedMarkdown pre,
236
+ html[data-theme="dark"] .swagger-ui .markdown pre {
197
237
  background: #0f172a;
198
238
  color: #e2e8f0;
199
239
  }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GrapeSwaggerRails
4
- VERSION = '1.0.4'
4
+ VERSION = '1.0.5'
5
5
  SWAGGER_UI_VERSION = '5.32.8'
6
6
  end
@@ -76,7 +76,18 @@ class API < Grape::API
76
76
 
77
77
  add_swagger_documentation(
78
78
  security_definitions: {
79
- api_key: { type: 'apiKey', name: 'Authorization', in: 'header' }
79
+ api_key: {
80
+ type: 'apiKey',
81
+ name: 'Authorization',
82
+ in: 'header',
83
+ description: <<~HTML
84
+ The default API authentication token.
85
+ <br>
86
+ <br>
87
+ Fetch a token using the <code>POST /api/sign_in</code> endpoint.<br>
88
+ Then use the following format: <code>Bearer {token}</code>, or include additional information with <code>one extra code block</code>, <code>another extra code block</code>, <code>BLOCK 1</code>, <code>Second block</code>, <code>Third block</code>, and <code>Last block</code>.
89
+ HTML
90
+ }
80
91
  }
81
92
  )
82
93
  end
@@ -111,6 +111,15 @@ describe 'Swagger' do
111
111
  find_by_id('input_apiKey').set(value)
112
112
  end
113
113
 
114
+ def auth_dialog_code_bg
115
+ find('.swagger-ui .scheme-container .btn.authorize', wait: 5).click
116
+ expect(page).to have_css('.swagger-ui .dialog-ux .markdown code', wait: 5)
117
+ page.evaluate_script(
118
+ '(function(){var c=document.querySelector(".swagger-ui .dialog-ux .markdown code");' \
119
+ 'return c?window.getComputedStyle(c).backgroundColor:null;})()'
120
+ )
121
+ end
122
+
114
123
  def open_operation(tag_id, operation_id)
115
124
  find("##{tag_id} .expand-operation").click
116
125
  find("##{operation_id} .opblock-control-arrow").click
@@ -851,9 +860,8 @@ describe 'Swagger' do
851
860
  it 'serves the api_key security definition in the swagger document' do
852
861
  document = swagger_document
853
862
 
854
- expect(document.fetch('securityDefinitions')).to eq(
855
- 'api_key' => { 'type' => 'apiKey', 'name' => 'Authorization',
856
- 'in' => 'header' }
863
+ expect(document.fetch('securityDefinitions')).to include(
864
+ 'api_key' => a_hash_including('type' => 'apiKey', 'name' => 'Authorization', 'in' => 'header')
857
865
  )
858
866
  end
859
867
 
@@ -885,6 +893,12 @@ describe 'Swagger' do
885
893
  expect(page).to have_css('#operations-foos-getApiFoos .opblock-summary', wait: 5)
886
894
  expect(page).to have_no_css('#operations-foos-getApiFoos .opblock-summary .authorization__btn')
887
895
  end
896
+
897
+ it 'renders inline code in the auth dialog without background bleed in dark mode' do
898
+ GrapeSwaggerRails.options.theme = 'dark'
899
+ visit_swagger
900
+ expect(auth_dialog_code_bg).to eq('rgb(15, 23, 42)')
901
+ end
888
902
  end
889
903
  end
890
904
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-swagger-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Logunov
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-07-15 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: haml-rails
@@ -173,8 +174,9 @@ licenses:
173
174
  metadata:
174
175
  bug_tracker_uri: https://github.com/ruby-grape/grape-swagger-rails/issues
175
176
  changelog_uri: https://github.com/ruby-grape/grape-swagger-rails/blob/master/CHANGELOG.md
176
- source_code_uri: https://github.com/ruby-grape/grape-swagger-rails/tree/v1.0.4
177
+ source_code_uri: https://github.com/ruby-grape/grape-swagger-rails/tree/v1.0.5
177
178
  rubygems_mfa_required: 'true'
179
+ post_install_message:
178
180
  rdoc_options: []
179
181
  require_paths:
180
182
  - lib
@@ -189,7 +191,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
191
  - !ruby/object:Gem::Version
190
192
  version: '0'
191
193
  requirements: []
192
- rubygems_version: 3.6.9
194
+ rubygems_version: 3.5.22
195
+ signing_key:
193
196
  specification_version: 4
194
197
  summary: Rails engine for serving Swagger UI for grape-swagger.
195
198
  test_files: []