grape-swagger-rails 1.0.2 → 1.0.4

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.
@@ -231,6 +231,7 @@ html[data-theme="dark"] .swagger-ui .model-box {
231
231
  border-color: #475569;
232
232
  }
233
233
 
234
+ .swagger-ui .model-box table.model tr.description > td,
234
235
  .swagger-ui .model-box table.model tr.property-row > td {
235
236
  vertical-align: baseline;
236
237
  }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GrapeSwaggerRails
4
- VERSION = '1.0.2'
5
- SWAGGER_UI_VERSION = '5.32.6'
4
+ VERSION = '1.0.4'
5
+ SWAGGER_UI_VERSION = '5.32.8'
6
6
  end
data/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "typecheck": "tsc -p tsconfig.json --noEmit"
10
10
  },
11
11
  "devDependencies": {
12
- "esbuild": "^0.25.0",
12
+ "esbuild": "^0.28.1",
13
13
  "typescript": "^5.8.3"
14
14
  }
15
15
  }
@@ -18,7 +18,7 @@ class API < Grape::API
18
18
  end
19
19
  end
20
20
 
21
- desc 'Get headers.'
21
+ desc 'Get headers.', security: [{ api_key: [] }]
22
22
  get '/headers' do
23
23
  request.headers.as_json
24
24
  end
@@ -74,7 +74,11 @@ class API < Grape::API
74
74
  }
75
75
  end
76
76
 
77
- add_swagger_documentation
77
+ add_swagger_documentation(
78
+ security_definitions: {
79
+ api_key: { type: 'apiKey', name: 'Authorization', in: 'header' }
80
+ }
81
+ )
78
82
  end
79
83
 
80
84
  class APIv2 < Grape::API
@@ -844,5 +844,47 @@ describe 'Swagger' do
844
844
  end
845
845
  end
846
846
  end
847
+
848
+ describe 'Authorize button (Swagger UI security schemes)' do
849
+ include_context 'with isolated options'
850
+
851
+ it 'serves the api_key security definition in the swagger document' do
852
+ document = swagger_document
853
+
854
+ expect(document.fetch('securityDefinitions')).to eq(
855
+ 'api_key' => { 'type' => 'apiKey', 'name' => 'Authorization',
856
+ 'in' => 'header' }
857
+ )
858
+ end
859
+
860
+ it 'records the per-endpoint security requirement on the secured operation' do
861
+ operation = swagger_document.dig('paths', '/api/headers', 'get')
862
+
863
+ expect(operation.fetch('security')).to eq([{ 'api_key' => [] }])
864
+ end
865
+
866
+ it 'renders the global Authorize button in the scheme container' do
867
+ visit_swagger
868
+
869
+ expect(page).to have_css('.swagger-ui .scheme-container .auth-wrapper .btn.authorize', wait: 5)
870
+ end
871
+
872
+ it 'renders the per-endpoint padlock on the secured operation' do
873
+ GrapeSwaggerRails.options.doc_expansion = 'list'
874
+ visit_swagger
875
+
876
+ expect(page).to have_css(
877
+ '#operations-headers-getApiHeaders .opblock-summary .authorization__btn', wait: 5
878
+ )
879
+ end
880
+
881
+ it 'does not render the padlock on operations without a security requirement' do
882
+ GrapeSwaggerRails.options.doc_expansion = 'list'
883
+ visit_swagger
884
+
885
+ expect(page).to have_css('#operations-foos-getApiFoos .opblock-summary', wait: 5)
886
+ expect(page).to have_no_css('#operations-foos-getApiFoos .opblock-summary .authorization__btn')
887
+ end
888
+ end
847
889
  end
848
890
  end
data/yarn.lock CHANGED
@@ -5,218 +5,218 @@ __metadata:
5
5
  version: 9
6
6
  cacheKey: 10c0
7
7
 
8
- "@esbuild/aix-ppc64@npm:0.25.12":
9
- version: 0.25.12
10
- resolution: "@esbuild/aix-ppc64@npm:0.25.12"
8
+ "@esbuild/aix-ppc64@npm:0.28.1":
9
+ version: 0.28.1
10
+ resolution: "@esbuild/aix-ppc64@npm:0.28.1"
11
11
  conditions: os=aix & cpu=ppc64
12
12
  languageName: node
13
13
  linkType: hard
14
14
 
15
- "@esbuild/android-arm64@npm:0.25.12":
16
- version: 0.25.12
17
- resolution: "@esbuild/android-arm64@npm:0.25.12"
15
+ "@esbuild/android-arm64@npm:0.28.1":
16
+ version: 0.28.1
17
+ resolution: "@esbuild/android-arm64@npm:0.28.1"
18
18
  conditions: os=android & cpu=arm64
19
19
  languageName: node
20
20
  linkType: hard
21
21
 
22
- "@esbuild/android-arm@npm:0.25.12":
23
- version: 0.25.12
24
- resolution: "@esbuild/android-arm@npm:0.25.12"
22
+ "@esbuild/android-arm@npm:0.28.1":
23
+ version: 0.28.1
24
+ resolution: "@esbuild/android-arm@npm:0.28.1"
25
25
  conditions: os=android & cpu=arm
26
26
  languageName: node
27
27
  linkType: hard
28
28
 
29
- "@esbuild/android-x64@npm:0.25.12":
30
- version: 0.25.12
31
- resolution: "@esbuild/android-x64@npm:0.25.12"
29
+ "@esbuild/android-x64@npm:0.28.1":
30
+ version: 0.28.1
31
+ resolution: "@esbuild/android-x64@npm:0.28.1"
32
32
  conditions: os=android & cpu=x64
33
33
  languageName: node
34
34
  linkType: hard
35
35
 
36
- "@esbuild/darwin-arm64@npm:0.25.12":
37
- version: 0.25.12
38
- resolution: "@esbuild/darwin-arm64@npm:0.25.12"
36
+ "@esbuild/darwin-arm64@npm:0.28.1":
37
+ version: 0.28.1
38
+ resolution: "@esbuild/darwin-arm64@npm:0.28.1"
39
39
  conditions: os=darwin & cpu=arm64
40
40
  languageName: node
41
41
  linkType: hard
42
42
 
43
- "@esbuild/darwin-x64@npm:0.25.12":
44
- version: 0.25.12
45
- resolution: "@esbuild/darwin-x64@npm:0.25.12"
43
+ "@esbuild/darwin-x64@npm:0.28.1":
44
+ version: 0.28.1
45
+ resolution: "@esbuild/darwin-x64@npm:0.28.1"
46
46
  conditions: os=darwin & cpu=x64
47
47
  languageName: node
48
48
  linkType: hard
49
49
 
50
- "@esbuild/freebsd-arm64@npm:0.25.12":
51
- version: 0.25.12
52
- resolution: "@esbuild/freebsd-arm64@npm:0.25.12"
50
+ "@esbuild/freebsd-arm64@npm:0.28.1":
51
+ version: 0.28.1
52
+ resolution: "@esbuild/freebsd-arm64@npm:0.28.1"
53
53
  conditions: os=freebsd & cpu=arm64
54
54
  languageName: node
55
55
  linkType: hard
56
56
 
57
- "@esbuild/freebsd-x64@npm:0.25.12":
58
- version: 0.25.12
59
- resolution: "@esbuild/freebsd-x64@npm:0.25.12"
57
+ "@esbuild/freebsd-x64@npm:0.28.1":
58
+ version: 0.28.1
59
+ resolution: "@esbuild/freebsd-x64@npm:0.28.1"
60
60
  conditions: os=freebsd & cpu=x64
61
61
  languageName: node
62
62
  linkType: hard
63
63
 
64
- "@esbuild/linux-arm64@npm:0.25.12":
65
- version: 0.25.12
66
- resolution: "@esbuild/linux-arm64@npm:0.25.12"
64
+ "@esbuild/linux-arm64@npm:0.28.1":
65
+ version: 0.28.1
66
+ resolution: "@esbuild/linux-arm64@npm:0.28.1"
67
67
  conditions: os=linux & cpu=arm64
68
68
  languageName: node
69
69
  linkType: hard
70
70
 
71
- "@esbuild/linux-arm@npm:0.25.12":
72
- version: 0.25.12
73
- resolution: "@esbuild/linux-arm@npm:0.25.12"
71
+ "@esbuild/linux-arm@npm:0.28.1":
72
+ version: 0.28.1
73
+ resolution: "@esbuild/linux-arm@npm:0.28.1"
74
74
  conditions: os=linux & cpu=arm
75
75
  languageName: node
76
76
  linkType: hard
77
77
 
78
- "@esbuild/linux-ia32@npm:0.25.12":
79
- version: 0.25.12
80
- resolution: "@esbuild/linux-ia32@npm:0.25.12"
78
+ "@esbuild/linux-ia32@npm:0.28.1":
79
+ version: 0.28.1
80
+ resolution: "@esbuild/linux-ia32@npm:0.28.1"
81
81
  conditions: os=linux & cpu=ia32
82
82
  languageName: node
83
83
  linkType: hard
84
84
 
85
- "@esbuild/linux-loong64@npm:0.25.12":
86
- version: 0.25.12
87
- resolution: "@esbuild/linux-loong64@npm:0.25.12"
85
+ "@esbuild/linux-loong64@npm:0.28.1":
86
+ version: 0.28.1
87
+ resolution: "@esbuild/linux-loong64@npm:0.28.1"
88
88
  conditions: os=linux & cpu=loong64
89
89
  languageName: node
90
90
  linkType: hard
91
91
 
92
- "@esbuild/linux-mips64el@npm:0.25.12":
93
- version: 0.25.12
94
- resolution: "@esbuild/linux-mips64el@npm:0.25.12"
92
+ "@esbuild/linux-mips64el@npm:0.28.1":
93
+ version: 0.28.1
94
+ resolution: "@esbuild/linux-mips64el@npm:0.28.1"
95
95
  conditions: os=linux & cpu=mips64el
96
96
  languageName: node
97
97
  linkType: hard
98
98
 
99
- "@esbuild/linux-ppc64@npm:0.25.12":
100
- version: 0.25.12
101
- resolution: "@esbuild/linux-ppc64@npm:0.25.12"
99
+ "@esbuild/linux-ppc64@npm:0.28.1":
100
+ version: 0.28.1
101
+ resolution: "@esbuild/linux-ppc64@npm:0.28.1"
102
102
  conditions: os=linux & cpu=ppc64
103
103
  languageName: node
104
104
  linkType: hard
105
105
 
106
- "@esbuild/linux-riscv64@npm:0.25.12":
107
- version: 0.25.12
108
- resolution: "@esbuild/linux-riscv64@npm:0.25.12"
106
+ "@esbuild/linux-riscv64@npm:0.28.1":
107
+ version: 0.28.1
108
+ resolution: "@esbuild/linux-riscv64@npm:0.28.1"
109
109
  conditions: os=linux & cpu=riscv64
110
110
  languageName: node
111
111
  linkType: hard
112
112
 
113
- "@esbuild/linux-s390x@npm:0.25.12":
114
- version: 0.25.12
115
- resolution: "@esbuild/linux-s390x@npm:0.25.12"
113
+ "@esbuild/linux-s390x@npm:0.28.1":
114
+ version: 0.28.1
115
+ resolution: "@esbuild/linux-s390x@npm:0.28.1"
116
116
  conditions: os=linux & cpu=s390x
117
117
  languageName: node
118
118
  linkType: hard
119
119
 
120
- "@esbuild/linux-x64@npm:0.25.12":
121
- version: 0.25.12
122
- resolution: "@esbuild/linux-x64@npm:0.25.12"
120
+ "@esbuild/linux-x64@npm:0.28.1":
121
+ version: 0.28.1
122
+ resolution: "@esbuild/linux-x64@npm:0.28.1"
123
123
  conditions: os=linux & cpu=x64
124
124
  languageName: node
125
125
  linkType: hard
126
126
 
127
- "@esbuild/netbsd-arm64@npm:0.25.12":
128
- version: 0.25.12
129
- resolution: "@esbuild/netbsd-arm64@npm:0.25.12"
127
+ "@esbuild/netbsd-arm64@npm:0.28.1":
128
+ version: 0.28.1
129
+ resolution: "@esbuild/netbsd-arm64@npm:0.28.1"
130
130
  conditions: os=netbsd & cpu=arm64
131
131
  languageName: node
132
132
  linkType: hard
133
133
 
134
- "@esbuild/netbsd-x64@npm:0.25.12":
135
- version: 0.25.12
136
- resolution: "@esbuild/netbsd-x64@npm:0.25.12"
134
+ "@esbuild/netbsd-x64@npm:0.28.1":
135
+ version: 0.28.1
136
+ resolution: "@esbuild/netbsd-x64@npm:0.28.1"
137
137
  conditions: os=netbsd & cpu=x64
138
138
  languageName: node
139
139
  linkType: hard
140
140
 
141
- "@esbuild/openbsd-arm64@npm:0.25.12":
142
- version: 0.25.12
143
- resolution: "@esbuild/openbsd-arm64@npm:0.25.12"
141
+ "@esbuild/openbsd-arm64@npm:0.28.1":
142
+ version: 0.28.1
143
+ resolution: "@esbuild/openbsd-arm64@npm:0.28.1"
144
144
  conditions: os=openbsd & cpu=arm64
145
145
  languageName: node
146
146
  linkType: hard
147
147
 
148
- "@esbuild/openbsd-x64@npm:0.25.12":
149
- version: 0.25.12
150
- resolution: "@esbuild/openbsd-x64@npm:0.25.12"
148
+ "@esbuild/openbsd-x64@npm:0.28.1":
149
+ version: 0.28.1
150
+ resolution: "@esbuild/openbsd-x64@npm:0.28.1"
151
151
  conditions: os=openbsd & cpu=x64
152
152
  languageName: node
153
153
  linkType: hard
154
154
 
155
- "@esbuild/openharmony-arm64@npm:0.25.12":
156
- version: 0.25.12
157
- resolution: "@esbuild/openharmony-arm64@npm:0.25.12"
155
+ "@esbuild/openharmony-arm64@npm:0.28.1":
156
+ version: 0.28.1
157
+ resolution: "@esbuild/openharmony-arm64@npm:0.28.1"
158
158
  conditions: os=openharmony & cpu=arm64
159
159
  languageName: node
160
160
  linkType: hard
161
161
 
162
- "@esbuild/sunos-x64@npm:0.25.12":
163
- version: 0.25.12
164
- resolution: "@esbuild/sunos-x64@npm:0.25.12"
162
+ "@esbuild/sunos-x64@npm:0.28.1":
163
+ version: 0.28.1
164
+ resolution: "@esbuild/sunos-x64@npm:0.28.1"
165
165
  conditions: os=sunos & cpu=x64
166
166
  languageName: node
167
167
  linkType: hard
168
168
 
169
- "@esbuild/win32-arm64@npm:0.25.12":
170
- version: 0.25.12
171
- resolution: "@esbuild/win32-arm64@npm:0.25.12"
169
+ "@esbuild/win32-arm64@npm:0.28.1":
170
+ version: 0.28.1
171
+ resolution: "@esbuild/win32-arm64@npm:0.28.1"
172
172
  conditions: os=win32 & cpu=arm64
173
173
  languageName: node
174
174
  linkType: hard
175
175
 
176
- "@esbuild/win32-ia32@npm:0.25.12":
177
- version: 0.25.12
178
- resolution: "@esbuild/win32-ia32@npm:0.25.12"
176
+ "@esbuild/win32-ia32@npm:0.28.1":
177
+ version: 0.28.1
178
+ resolution: "@esbuild/win32-ia32@npm:0.28.1"
179
179
  conditions: os=win32 & cpu=ia32
180
180
  languageName: node
181
181
  linkType: hard
182
182
 
183
- "@esbuild/win32-x64@npm:0.25.12":
184
- version: 0.25.12
185
- resolution: "@esbuild/win32-x64@npm:0.25.12"
183
+ "@esbuild/win32-x64@npm:0.28.1":
184
+ version: 0.28.1
185
+ resolution: "@esbuild/win32-x64@npm:0.28.1"
186
186
  conditions: os=win32 & cpu=x64
187
187
  languageName: node
188
188
  linkType: hard
189
189
 
190
- "esbuild@npm:^0.25.0":
191
- version: 0.25.12
192
- resolution: "esbuild@npm:0.25.12"
190
+ "esbuild@npm:^0.28.1":
191
+ version: 0.28.1
192
+ resolution: "esbuild@npm:0.28.1"
193
193
  dependencies:
194
- "@esbuild/aix-ppc64": "npm:0.25.12"
195
- "@esbuild/android-arm": "npm:0.25.12"
196
- "@esbuild/android-arm64": "npm:0.25.12"
197
- "@esbuild/android-x64": "npm:0.25.12"
198
- "@esbuild/darwin-arm64": "npm:0.25.12"
199
- "@esbuild/darwin-x64": "npm:0.25.12"
200
- "@esbuild/freebsd-arm64": "npm:0.25.12"
201
- "@esbuild/freebsd-x64": "npm:0.25.12"
202
- "@esbuild/linux-arm": "npm:0.25.12"
203
- "@esbuild/linux-arm64": "npm:0.25.12"
204
- "@esbuild/linux-ia32": "npm:0.25.12"
205
- "@esbuild/linux-loong64": "npm:0.25.12"
206
- "@esbuild/linux-mips64el": "npm:0.25.12"
207
- "@esbuild/linux-ppc64": "npm:0.25.12"
208
- "@esbuild/linux-riscv64": "npm:0.25.12"
209
- "@esbuild/linux-s390x": "npm:0.25.12"
210
- "@esbuild/linux-x64": "npm:0.25.12"
211
- "@esbuild/netbsd-arm64": "npm:0.25.12"
212
- "@esbuild/netbsd-x64": "npm:0.25.12"
213
- "@esbuild/openbsd-arm64": "npm:0.25.12"
214
- "@esbuild/openbsd-x64": "npm:0.25.12"
215
- "@esbuild/openharmony-arm64": "npm:0.25.12"
216
- "@esbuild/sunos-x64": "npm:0.25.12"
217
- "@esbuild/win32-arm64": "npm:0.25.12"
218
- "@esbuild/win32-ia32": "npm:0.25.12"
219
- "@esbuild/win32-x64": "npm:0.25.12"
194
+ "@esbuild/aix-ppc64": "npm:0.28.1"
195
+ "@esbuild/android-arm": "npm:0.28.1"
196
+ "@esbuild/android-arm64": "npm:0.28.1"
197
+ "@esbuild/android-x64": "npm:0.28.1"
198
+ "@esbuild/darwin-arm64": "npm:0.28.1"
199
+ "@esbuild/darwin-x64": "npm:0.28.1"
200
+ "@esbuild/freebsd-arm64": "npm:0.28.1"
201
+ "@esbuild/freebsd-x64": "npm:0.28.1"
202
+ "@esbuild/linux-arm": "npm:0.28.1"
203
+ "@esbuild/linux-arm64": "npm:0.28.1"
204
+ "@esbuild/linux-ia32": "npm:0.28.1"
205
+ "@esbuild/linux-loong64": "npm:0.28.1"
206
+ "@esbuild/linux-mips64el": "npm:0.28.1"
207
+ "@esbuild/linux-ppc64": "npm:0.28.1"
208
+ "@esbuild/linux-riscv64": "npm:0.28.1"
209
+ "@esbuild/linux-s390x": "npm:0.28.1"
210
+ "@esbuild/linux-x64": "npm:0.28.1"
211
+ "@esbuild/netbsd-arm64": "npm:0.28.1"
212
+ "@esbuild/netbsd-x64": "npm:0.28.1"
213
+ "@esbuild/openbsd-arm64": "npm:0.28.1"
214
+ "@esbuild/openbsd-x64": "npm:0.28.1"
215
+ "@esbuild/openharmony-arm64": "npm:0.28.1"
216
+ "@esbuild/sunos-x64": "npm:0.28.1"
217
+ "@esbuild/win32-arm64": "npm:0.28.1"
218
+ "@esbuild/win32-ia32": "npm:0.28.1"
219
+ "@esbuild/win32-x64": "npm:0.28.1"
220
220
  dependenciesMeta:
221
221
  "@esbuild/aix-ppc64":
222
222
  optional: true
@@ -272,7 +272,7 @@ __metadata:
272
272
  optional: true
273
273
  bin:
274
274
  esbuild: bin/esbuild
275
- checksum: 10c0/c205357531423220a9de8e1e6c6514242bc9b1666e762cd67ccdf8fdfdc3f1d0bd76f8d9383958b97ad4c953efdb7b6e8c1f9ca5951cd2b7c5235e8755b34a6b
275
+ checksum: 10c0/29cd456a79ce35ac2c7e05fe871330416b2c395c045d849653f843e51378d6e0d6e774d6dcd01b35f4e83238a29bf8decd04fcd34b3780c589a250b21e5f92bb
276
276
  languageName: node
277
277
  linkType: hard
278
278
 
@@ -280,7 +280,7 @@ __metadata:
280
280
  version: 0.0.0-use.local
281
281
  resolution: "grape-swagger-rails@workspace:."
282
282
  dependencies:
283
- esbuild: "npm:^0.25.0"
283
+ esbuild: "npm:^0.28.1"
284
284
  typescript: "npm:^5.8.3"
285
285
  languageName: unknown
286
286
  linkType: soft
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-swagger-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Logunov
@@ -91,6 +91,7 @@ files:
91
91
  - ".rubocop.yml"
92
92
  - ".rubocop_todo.yml"
93
93
  - ".ruby-gemset"
94
+ - ".yarnrc.yml"
94
95
  - CHANGELOG.md
95
96
  - CLAUDE.md
96
97
  - CONTRIBUTING.md
@@ -172,7 +173,7 @@ licenses:
172
173
  metadata:
173
174
  bug_tracker_uri: https://github.com/ruby-grape/grape-swagger-rails/issues
174
175
  changelog_uri: https://github.com/ruby-grape/grape-swagger-rails/blob/master/CHANGELOG.md
175
- source_code_uri: https://github.com/ruby-grape/grape-swagger-rails/tree/v1.0.2
176
+ source_code_uri: https://github.com/ruby-grape/grape-swagger-rails/tree/v1.0.4
176
177
  rubygems_mfa_required: 'true'
177
178
  rdoc_options: []
178
179
  require_paths: