grape-swagger 0.32.0 → 0.32.1

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
  SHA256:
3
- metadata.gz: ea7cb947847696a10190ade08cfbe8bf19364a4b5855d932abda009c672122c4
4
- data.tar.gz: 8a9c2f4a2bff62b247b795b6082d825d9403382ef56626f93ed697b4b654dc54
3
+ metadata.gz: 1c5f4e8337c6872fe55038b194145b68b2f590d5b0c1a69e21968ce3c2cd15ab
4
+ data.tar.gz: 37af5bafa392cd66f53636e5e586b6763ecab6596d31250977644482183b5506
5
5
  SHA512:
6
- metadata.gz: 45dfe914ee2225ab36174fd182563a56aaf8cfb78f9aaccdc8a4070e47acb41e0010f31c283d6bef76819a296539457da5095191e17e181d0acf4271f743bcf0
7
- data.tar.gz: 0ab65509589c8537b7f77810dd76be2fb50e092796570a333704a9b06893e8a5756988465214752df3b0a2093a731e33e10b229b7c879568e28d2f247a79dd68
6
+ metadata.gz: f994d0712a3cdb78c37536ca4a636b986ed48178daeed7b0dcb86fe02b75ffb0b2844cacddac3f767213d461efc6f1ba15adea681622ee5add22c0a5ec31c74e
7
+ data.tar.gz: 3ccae0f447dfd4e4517e3d5f02e33678b3733a999d2bd1c81a9a9f54d29d201cd0c378b64f20932dcbbe41b660ffad742d1940bab0094b64586802655cb44b49
@@ -7,19 +7,19 @@ before_install:
7
7
  - gem install bundler
8
8
 
9
9
  after_success:
10
- - coveralls
10
+ # - coveralls
11
11
  - bundle exec danger
12
12
 
13
13
  rvm:
14
14
  - 2.4.5
15
15
  - 2.5.3
16
- - 2.6.0-preview2
16
+ - 2.6.0-rc1
17
17
  env:
18
18
  - MODEL_PARSER=grape-swagger-entity
19
19
  - MODEL_PARSER=grape-swagger-representable
20
20
  - GRAPE_VERSION=0.19.2
21
21
  - GRAPE_VERSION=1.0.3
22
- - GRAPE_VERSION=1.2.0
22
+ - GRAPE_VERSION=1.2.2
23
23
  - GRAPE_VERSION=HEAD
24
24
 
25
25
  matrix:
@@ -8,6 +8,13 @@
8
8
 
9
9
  * Your contribution here.
10
10
 
11
+ ### 0.32.1 (December 7, 2018)
12
+
13
+ #### Fixes
14
+
15
+ * [#731](https://github.com/ruby-grape/grape-swagger/pull/731): Skip empty parameters and tags arrays - [@fotos](https://github.com/fotos).
16
+ * [#729](https://github.com/ruby-grape/grape-swagger/pull/729): Allow empty security array for endpoints - [@fotos](https://github.com/fotos).
17
+
11
18
  ### 0.32.0 (November 26, 2018)
12
19
 
13
20
  #### Features
data/Gemfile CHANGED
@@ -30,7 +30,7 @@ group :development, :test do
30
30
  if RUBY_VERSION == '2.6.0'
31
31
  gem 'rubocop', git: 'https://github.com/rubocop-hq/rubocop.git', require: false
32
32
  else
33
- gem 'rubocop', '~> 0.60', require: false
33
+ gem 'rubocop', '~> 0.61', require: false
34
34
  end
35
35
  end
36
36
 
@@ -125,7 +125,7 @@ module Grape
125
125
  method[:tags] = route.options.fetch(:tags, tag_object(route, path))
126
126
  method[:operationId] = GrapeSwagger::DocMethods::OperationId.build(route, path)
127
127
  method[:deprecated] = deprecated_object(route)
128
- method.delete_if { |_, value| value.blank? }
128
+ method.delete_if { |_, value| value.nil? }
129
129
 
130
130
  [route.request_method.downcase.to_sym, method]
131
131
  end
@@ -149,7 +149,6 @@ module Grape
149
149
  def description_object(route)
150
150
  description = route.description if route.description.present?
151
151
  description = route.options[:detail] if route.options.key?(:detail)
152
- description ||= ''
153
152
 
154
153
  description
155
154
  end
@@ -192,7 +191,7 @@ module Grape
192
191
  parameters = GrapeSwagger::DocMethods::MoveParams.to_definition(path, parameters, route, @definitions)
193
192
  end
194
193
 
195
- parameters
194
+ parameters.presence
196
195
  end
197
196
 
198
197
  def response_object(route)
@@ -258,11 +257,12 @@ module Grape
258
257
  def tag_object(route, path)
259
258
  version = GrapeSwagger::DocMethods::Version.get(route)
260
259
  version = [version] unless version.is_a?(Array)
260
+
261
261
  Array(
262
262
  path.split('{')[0].split('/').reject(&:empty?).delete_if do |i|
263
263
  i == route.prefix.to_s || version.map(&:to_s).include?(i)
264
264
  end.first
265
- )
265
+ ).presence
266
266
  end
267
267
 
268
268
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GrapeSwagger
4
- VERSION = '0.32.0'
4
+ VERSION = '0.32.1'
5
5
  end
@@ -2,14 +2,14 @@
2
2
 
3
3
  if RUBY_ENGINE == 'ruby'
4
4
  require 'simplecov'
5
- require 'coveralls'
5
+ # require 'coveralls'
6
6
 
7
- SimpleCov.formatter = Coveralls::SimpleCov::Formatter
7
+ # SimpleCov.formatter = Coveralls::SimpleCov::Formatter
8
8
  SimpleCov.start do
9
9
  add_filter 'spec/'
10
- add_filter 'example/'
10
+ # add_filter 'example/'
11
11
  end
12
- Coveralls.wear!
12
+ # Coveralls.wear!
13
13
  end
14
14
 
15
15
  $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
@@ -10,7 +10,24 @@ describe 'security requirement on endpoint method' do
10
10
  { foo: 'bar' }
11
11
  end
12
12
 
13
- add_swagger_documentation
13
+ desc 'Endpoint without security requirement', security: []
14
+ get '/without_security' do
15
+ { foo: 'bar' }
16
+ end
17
+
18
+ add_swagger_documentation(
19
+ security_definitions: {
20
+ petstore_auth: {
21
+ type: 'oauth2',
22
+ flow: 'implicit',
23
+ authorizationUrl: 'https://petstore.swagger.io/oauth/dialog',
24
+ scopes: {
25
+ 'read:pets': 'read your pets',
26
+ 'write:pets': 'modify pets in your account'
27
+ }
28
+ }
29
+ }
30
+ )
14
31
  end
15
32
  end
16
33
 
@@ -22,4 +39,8 @@ describe 'security requirement on endpoint method' do
22
39
  it 'defines the security requirement on the endpoint method' do
23
40
  expect(subject['paths']['/with_security']['get']['security']).to eql ['oauth_pets' => ['read:pets', 'write:pets']]
24
41
  end
42
+
43
+ it 'defines an empty security requirement on the endpoint method' do
44
+ expect(subject['paths']['/without_security']['get']['security']).to eql []
45
+ end
25
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-swagger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.32.0
4
+ version: 0.32.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Vandecasteele
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-26 00:00:00.000000000 Z
11
+ date: 2018-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape