grape-swagger-rails 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 852e5a4e529fe03a53574322652d87d8f86d0b9f
4
- data.tar.gz: a36eb32043340646513c5acc3417d715e28b995a
3
+ metadata.gz: 84e0dcac9503bab3850c3b2ab2a56ca233a1dd7f
4
+ data.tar.gz: 5c0ddd5f4035837956c0b48bc1f2a906c0d3df69
5
5
  SHA512:
6
- metadata.gz: 5dee8b6abab769ea0e71f89fe69b38c9b094f97951a0edba2bd5644c8a404686665661fe9b15f0b1bea5ac823ce6123b692fef6d5b338a89e6cf8b0a76903100
7
- data.tar.gz: 8d5055d846fb79450e051f3e76993b4ef2b513f98202f47a9e188d8797fe84390a1ca78093353e35d7753060cc04748957edc4a2dabe7db0580f1afc0717f1cd
6
+ metadata.gz: 8383f381bc659e4e06c2baabe7d31fd2878a93fdc3f4b19ff1e93cd0d38e9efac8a39f903609f2072803b91dacb60a3f4406a3f0a6ffdef6afc5d1da5bb2324b
7
+ data.tar.gz: 2d8767b39cee67dc44c8ecc89bbadae79e40bd8e65f6ad2bb997ee639fcb8d507e4091b5890ea3b1a6dd786a00892e3140b1348a19449d0086735423a57fb850
@@ -0,0 +1 @@
1
+ grape-swagger-rails
@@ -1,9 +1,14 @@
1
+ ### 0.2.2 (July 13, 2016)
2
+
3
+ * [#57](https://github.com/ruby-grape/grape-swagger-rails/pull/57): Support Swagger-UI supportedSubmitMethods option - [@ShadowWrathOogles](https://github.com/ShadowWrathOogles).
4
+ * [#61](https://github.com/ruby-grape/grape-swagger-rails/pull/61): Removed grape and grape-swagger from required dependencies - [@aschuster3](https://github.com/aschuster3).
5
+
1
6
  ### 0.2.1 (May 21, 2016)
2
7
 
3
8
  * Fixed header-based authorization - [@davidbrewer](https://github.com/davidbrewer).
4
9
  * Support Swagger-UI validatorUrl option - [@davidbrewer](https://github.com/davidbrewer).
5
10
  * Support for grape 0.14.x through 0.16.x and grape-swagger 0.11.x through 0.20.x - [@dblock](https://github.com/dblock).
6
- * [#55](https://github.com/ruby-grape/grape-swagger-rails/pull/55): Update Swagger-UI assets and add ability to hide input boxes - [@aschuster93](https://github.com/aschuster93).
11
+ * [#55](https://github.com/ruby-grape/grape-swagger-rails/pull/55): Update Swagger-UI assets and add ability to hide input boxes - [@aschuster3](https://github.com/aschuster3).
7
12
 
8
13
  ### 0.2.0 (February 23, 2016)
9
14
 
data/README.md CHANGED
@@ -75,6 +75,14 @@ See the official Swagger-UI documentation about [SwaggerUi Parameters](https://g
75
75
  GrapeSwaggerRails.options.doc_expansion = 'list'
76
76
  ```
77
77
 
78
+ You can set supportedSubmitMethods with an array of the supported HTTP methods, default is `%w{ get post put delete patch }`.
79
+
80
+ See the official Swagger-UI documentation about [SwaggerUi Parameters](https://github.com/swagger-api/swagger-ui#parameters).
81
+
82
+ ```ruby
83
+ GrapeSwaggerRails.options.supported_submit_methods = ["get"]
84
+ ```
85
+
78
86
  You can set validatorUrl to your own locally deployed Swagger validator, or disable validation by setting this option to nil.
79
87
  This is useful to avoid error messages when running Swagger-UI on a server which is not accessible from outside your network.
80
88
 
@@ -19,7 +19,7 @@
19
19
  url: options.app_url + options.url,
20
20
  dom_id: "swagger-ui-container",
21
21
  supportHeaderParams: true,
22
- supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
22
+ supportedSubmitMethods: options.supported_submit_methods || [],
23
23
  authorizations: headers,
24
24
  onComplete: function(swaggerApi, swaggerUi){
25
25
  if('console' in window) {
@@ -17,7 +17,6 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = %w(lib)
18
18
 
19
19
  spec.add_dependency 'railties', '>= 3.2.12'
20
- spec.add_dependency 'grape-swagger', '>= 0.7.2'
21
20
 
22
21
  spec.add_development_dependency 'bundler', '~> 1.3'
23
22
  spec.add_development_dependency 'rake'
@@ -25,6 +24,7 @@ Gem::Specification.new do |spec|
25
24
  spec.add_development_dependency 'rspec-rails'
26
25
  spec.add_development_dependency 'capybara'
27
26
  spec.add_development_dependency 'grape'
27
+ spec.add_development_dependency 'grape-swagger', '>= 0.7.2'
28
28
  spec.add_development_dependency 'selenium-webdriver'
29
29
  spec.add_development_dependency 'sass-rails'
30
30
  spec.add_development_dependency 'uglifier'
@@ -27,6 +27,7 @@ module GrapeSwaggerRails
27
27
  api_key_default_value: '', # Auto populates api_key
28
28
 
29
29
  doc_expansion: 'none',
30
+ supported_submit_methods: %w(get post put delete patch),
30
31
 
31
32
  before_filter_proc: nil, # Proc used as a controller before filter
32
33
 
@@ -1,3 +1,3 @@
1
1
  module GrapeSwaggerRails
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -16,6 +16,13 @@ describe 'Swagger' do
16
16
  before do
17
17
  @options = GrapeSwaggerRails.options.dup
18
18
  end
19
+
20
+ it 'evaluates config options correctly' do
21
+ visit '/swagger'
22
+ page_options_json = page.evaluate_script("$('html').data('swagger-options')").to_json
23
+ expect(page_options_json).to eq(@options.marshal_dump.to_json)
24
+ end
25
+
19
26
  context '#headers' do
20
27
  before do
21
28
  GrapeSwaggerRails.options.headers['X-Test-Header'] = 'Test Value'
@@ -153,6 +160,55 @@ describe 'Swagger' do
153
160
  end
154
161
  end
155
162
  end
163
+ context '#supported_submit_methods' do
164
+ context 'set all operations' do
165
+ before do
166
+ GrapeSwaggerRails.options.supported_submit_methods = %w(get post put delete patch)
167
+ visit '/swagger'
168
+ end
169
+ it 'sets SwaggerUI supportedSubmitMethods with all operations' do
170
+ expect(page.evaluate_script('window.swaggerUi.options.supportedSubmitMethods.length')).to eq 5
171
+ find('#endpointListTogger_params', visible: true).click
172
+ first('span[class="http_method"] a', visible: true).click
173
+ expect(page).to have_button('Try it out!', disabled: false)
174
+ end
175
+ end
176
+ context 'set some operations' do
177
+ before do
178
+ GrapeSwaggerRails.options.supported_submit_methods = ['post']
179
+ visit '/swagger'
180
+ end
181
+ it 'sets SwaggerUI supportedSubmitMethods with some operations' do
182
+ expect(page.evaluate_script('window.swaggerUi.options.supportedSubmitMethods.length')).to eq 1
183
+ find('#endpointListTogger_params', visible: true).click
184
+ first('span[class="http_method"] a', visible: true).click
185
+ expect(page).not_to have_button('Try it out!')
186
+ end
187
+ end
188
+ context 'set nil' do
189
+ before do
190
+ GrapeSwaggerRails.options.supported_submit_methods = nil
191
+ visit '/swagger'
192
+ end
193
+ it 'clears SwaggerUI supportedSubmitMethods' do
194
+ expect(page.evaluate_script('window.swaggerUi.options.supportedSubmitMethods.length')).to eq 0
195
+ find('#endpointListTogger_params', visible: true).click
196
+ first('span[class="http_method"] a', visible: true).click
197
+ expect(page).not_to have_button('Try it out!')
198
+ end
199
+ end
200
+ context 'not set' do
201
+ before do
202
+ visit '/swagger'
203
+ end
204
+ it 'defaults SwaggerUI supportedSubmitMethods' do
205
+ expect(page.evaluate_script('window.swaggerUi.options.supportedSubmitMethods.length')).to eq 5
206
+ find('#endpointListTogger_params', visible: true).click
207
+ first('span[class="http_method"] a', visible: true).click
208
+ expect(page).to have_button('Try it out!', disabled: false)
209
+ end
210
+ end
211
+ end
156
212
  context '#validator_url' do
157
213
  context 'set null' do
158
214
  before do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-swagger-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Logunov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-21 00:00:00.000000000 Z
11
+ date: 2016-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.12
27
- - !ruby/object:Gem::Dependency
28
- name: grape-swagger
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 0.7.2
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: 0.7.2
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +108,20 @@ dependencies:
122
108
  - - ">="
123
109
  - !ruby/object:Gem::Version
124
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: grape-swagger
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: 0.7.2
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: 0.7.2
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: selenium-webdriver
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -301,6 +301,7 @@ files:
301
301
  - ".rspec"
302
302
  - ".rubocop.yml"
303
303
  - ".rubocop_todo.yml"
304
+ - ".ruby-gemset"
304
305
  - ".travis.yml"
305
306
  - CHANGELOG.md
306
307
  - CONTRIBUTING.md