grape-swagger 0.32.0 → 0.32.1
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 +4 -4
- data/.travis.yml +3 -3
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -1
- data/lib/grape-swagger/endpoint.rb +4 -4
- data/lib/grape-swagger/version.rb +1 -1
- data/spec/spec_helper.rb +4 -4
- data/spec/swagger_v2/security_requirement_spec.rb +22 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c5f4e8337c6872fe55038b194145b68b2f590d5b0c1a69e21968ce3c2cd15ab
|
4
|
+
data.tar.gz: 37af5bafa392cd66f53636e5e586b6763ecab6596d31250977644482183b5506
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f994d0712a3cdb78c37536ca4a636b986ed48178daeed7b0dcb86fe02b75ffb0b2844cacddac3f767213d461efc6f1ba15adea681622ee5add22c0a5ec31c74e
|
7
|
+
data.tar.gz: 3ccae0f447dfd4e4517e3d5f02e33678b3733a999d2bd1c81a9a9f54d29d201cd0c378b64f20932dcbbe41b660ffad742d1940bab0094b64586802655cb44b49
|
data/.travis.yml
CHANGED
@@ -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-
|
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.
|
22
|
+
- GRAPE_VERSION=1.2.2
|
23
23
|
- GRAPE_VERSION=HEAD
|
24
24
|
|
25
25
|
matrix:
|
data/CHANGELOG.md
CHANGED
@@ -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
@@ -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.
|
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
|
data/spec/spec_helper.rb
CHANGED
@@ -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
|
-
|
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.
|
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
|
+
date: 2018-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape
|