Skip to content

Commit

Permalink
Prepare release 1.3.0 (#808)
Browse files Browse the repository at this point in the history
- updates and satisfy rubocop 0.90
- fixes ruby warnings
- adds truffelruby-head to travis
  • Loading branch information
LeFnord authored Sep 4, 2020
1 parent 565f8e9 commit 08b8c2f
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 11 deletions.
7 changes: 5 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ AllCops:
Exclude:
- vendor/**/*
- example/**/*
NewCops: enable
TargetRubyVersion: 2.7

# Layout stuff
Expand Down Expand Up @@ -80,8 +81,12 @@ Style/CaseLikeIf:
Style/ExponentialNotation:
Enabled: true

Style/ExplicitBlockArgument:
Enabled: false

Style/HashAsLastArrayItem:
Enabled: true

Style/HashEachMethods:
Enabled: true

Expand Down Expand Up @@ -114,5 +119,3 @@ Style/RedundantRegexpEscape:

Style/SlicingWithRange:
Enabled: false


4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ jobs:
env:
- rvm: jruby-head
env:
- rvm: truffleruby-head
env:
script: bundle exec rake spec

allow_failures:
- rvm: 2.4.10
- rvm: ruby-head
- rvm: jruby-head
- rvm: truffleruby-head
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
#### Fixes

* Your contribution here.
* [#804](https://github.com/ruby-grape/grape-swagger/pull/804): Don't overwrite model description with the route description. - [@Bhacaz](https://github.com/Bhacaz)


### 1.3.0 (September 3, 2020)

#### Features

* [#804](https://github.com/ruby-grape/grape-swagger/pull/804): Don't overwrite model description with the route description - [@Bhacaz](https://github.com/Bhacaz).


### 1.2.1 (July 15, 2020)

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ group :development, :test do
gem 'rake'
gem 'rdoc'
gem 'rspec', '~> 3.9'
gem 'rubocop', '~> 0.88', require: false
gem 'rubocop', '~> 0.90', require: false
end

group :test do
Expand Down
4 changes: 2 additions & 2 deletions lib/grape-swagger/doc_methods/format_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class << self
def to_format(parameters)
parameters.reject { |parameter| parameter[:in] == 'body' }.each do |b|
related_parameters = parameters.select do |p|
p[:name] != b[:name] && p[:name].to_s.include?(b[:name].to_s.gsub(/\[\]\z/, '') + '[')
p[:name] != b[:name] && p[:name].to_s.include?("#{b[:name].to_s.gsub(/\[\]\z/, '')}[")
end
parameters.reject! { |p| p[:name] == b[:name] } if move_down(b, related_parameters)
end
Expand All @@ -30,7 +30,7 @@ def move_down(parameter, related_parameters)

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

def add_array(parameter, related_parameters)
Expand Down
4 changes: 2 additions & 2 deletions lib/grape-swagger/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def content_types_for(target_class)

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

def hidden_parameter?(value)
return false if value.dig(:required)
return false if value[:required]

if value.dig(:documentation, :hidden).is_a?(Proc)
value.dig(:documentation, :hidden).call
Expand Down
2 changes: 2 additions & 0 deletions lib/grape-swagger/rake/oapi_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def validate

# helper methods
#
# rubocop:disable Style/StringConcatenation
def make_request
get url_for

Expand All @@ -83,6 +84,7 @@ def make_request
)
) + "\n"
end
# rubocop:enable Style/StringConcatenation

def url_for
oapi_route = api_class.routes[-2]
Expand Down
2 changes: 1 addition & 1 deletion lib/grape-swagger/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module GrapeSwagger
VERSION = '1.2.1'
VERSION = '1.3.0'
end
4 changes: 2 additions & 2 deletions spec/lib/move_params_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
let(:route_options) { { requirements: {} } }
describe 'POST' do
let(:params) { paths[path][:post][:parameters] }
let(:route) { Grape::Router::Route.new('POST', path.dup, route_options) }
let(:route) { Grape::Router::Route.new('POST', path.dup, **route_options) }

specify do
subject.to_definition(path, params, route, definitions)
Expand All @@ -113,7 +113,7 @@

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

specify do
subject.to_definition(path, params, route, definitions)
Expand Down

0 comments on commit 08b8c2f

Please sign in to comment.