Skip to content

Commit 08b8c2f

Browse files
authored
Prepare release 1.3.0 (#808)
- updates and satisfy rubocop 0.90 - fixes ruby warnings - adds truffelruby-head to travis
1 parent 565f8e9 commit 08b8c2f

File tree

9 files changed

+27
-11
lines changed

9 files changed

+27
-11
lines changed

.rubocop.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ AllCops:
44
Exclude:
55
- vendor/**/*
66
- example/**/*
7+
NewCops: enable
78
TargetRubyVersion: 2.7
89

910
# Layout stuff
@@ -80,8 +81,12 @@ Style/CaseLikeIf:
8081
Style/ExponentialNotation:
8182
Enabled: true
8283

84+
Style/ExplicitBlockArgument:
85+
Enabled: false
86+
8387
Style/HashAsLastArrayItem:
8488
Enabled: true
89+
8590
Style/HashEachMethods:
8691
Enabled: true
8792

@@ -114,5 +119,3 @@ Style/RedundantRegexpEscape:
114119

115120
Style/SlicingWithRange:
116121
Enabled: false
117-
118-

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ jobs:
2929
env:
3030
- rvm: jruby-head
3131
env:
32+
- rvm: truffleruby-head
33+
env:
34+
script: bundle exec rake spec
3235

3336
allow_failures:
3437
- rvm: 2.4.10
3538
- rvm: ruby-head
3639
- rvm: jruby-head
40+
- rvm: truffleruby-head

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
#### Fixes
88

99
* Your contribution here.
10-
* [#804](https://github.com/ruby-grape/grape-swagger/pull/804): Don't overwrite model description with the route description. - [@Bhacaz](https://github.com/Bhacaz)
10+
11+
12+
### 1.3.0 (September 3, 2020)
13+
14+
#### Features
15+
16+
* [#804](https://github.com/ruby-grape/grape-swagger/pull/804): Don't overwrite model description with the route description - [@Bhacaz](https://github.com/Bhacaz).
17+
1118

1219
### 1.2.1 (July 15, 2020)
1320

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ group :development, :test do
2727
gem 'rake'
2828
gem 'rdoc'
2929
gem 'rspec', '~> 3.9'
30-
gem 'rubocop', '~> 0.88', require: false
30+
gem 'rubocop', '~> 0.90', require: false
3131
end
3232

3333
group :test do

lib/grape-swagger/doc_methods/format_data.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class << self
77
def to_format(parameters)
88
parameters.reject { |parameter| parameter[:in] == 'body' }.each do |b|
99
related_parameters = parameters.select do |p|
10-
p[:name] != b[:name] && p[:name].to_s.include?(b[:name].to_s.gsub(/\[\]\z/, '') + '[')
10+
p[:name] != b[:name] && p[:name].to_s.include?("#{b[:name].to_s.gsub(/\[\]\z/, '')}[")
1111
end
1212
parameters.reject! { |p| p[:name] == b[:name] } if move_down(b, related_parameters)
1313
end
@@ -30,7 +30,7 @@ def move_down(parameter, related_parameters)
3030

3131
def add_braces(parameter, related_parameters)
3232
param_name = parameter[:name].gsub(/\A(.*)\[\]\z/, '\1')
33-
related_parameters.each { |p| p[:name] = p[:name].gsub(param_name, param_name + '[]') }
33+
related_parameters.each { |p| p[:name] = p[:name].gsub(param_name, "#{param_name}[]") }
3434
end
3535

3636
def add_array(parameter, related_parameters)

lib/grape-swagger/endpoint.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def content_types_for(target_class)
1111

1212
if content_types.empty?
1313
formats = [target_class.format, target_class.default_format].compact.uniq
14-
formats = Grape::Formatter.formatters({}).keys if formats.empty?
14+
formats = Grape::Formatter.formatters(**{}).keys if formats.empty?
1515
content_types = Grape::ContentTypes::CONTENT_TYPES.select do |content_type, _mime_type|
1616
formats.include? content_type
1717
end.values
@@ -365,7 +365,7 @@ def hidden?(route, options)
365365
end
366366

367367
def hidden_parameter?(value)
368-
return false if value.dig(:required)
368+
return false if value[:required]
369369

370370
if value.dig(:documentation, :hidden).is_a?(Proc)
371371
value.dig(:documentation, :hidden).call

lib/grape-swagger/rake/oapi_tasks.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def validate
7474

7575
# helper methods
7676
#
77+
# rubocop:disable Style/StringConcatenation
7778
def make_request
7879
get url_for
7980

@@ -83,6 +84,7 @@ def make_request
8384
)
8485
) + "\n"
8586
end
87+
# rubocop:enable Style/StringConcatenation
8688

8789
def url_for
8890
oapi_route = api_class.routes[-2]

lib/grape-swagger/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module GrapeSwagger
4-
VERSION = '1.2.1'
4+
VERSION = '1.3.0'
55
end

spec/lib/move_params_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
let(:route_options) { { requirements: {} } }
9898
describe 'POST' do
9999
let(:params) { paths[path][:post][:parameters] }
100-
let(:route) { Grape::Router::Route.new('POST', path.dup, route_options) }
100+
let(:route) { Grape::Router::Route.new('POST', path.dup, **route_options) }
101101

102102
specify do
103103
subject.to_definition(path, params, route, definitions)
@@ -113,7 +113,7 @@
113113

114114
describe 'POST' do
115115
let(:params) { paths['/in_body/{key}'][:put][:parameters] }
116-
let(:route) { Grape::Router::Route.new('PUT', path.dup, route_options) }
116+
let(:route) { Grape::Router::Route.new('PUT', path.dup, **route_options) }
117117

118118
specify do
119119
subject.to_definition(path, params, route, definitions)

0 commit comments

Comments
 (0)