diff --git a/CHANGELOG.md b/CHANGELOG.md index 695c0929..fd6b7cdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ #### Fixes +* [#000](https://github.com/ruby-grape/grape-swagger/pull/000): Grape 2.0.2 compatibility - [@padde](https://github.com/padde) * Your contribution here. diff --git a/grape-swagger.gemspec b/grape-swagger.gemspec index 80377959..22752815 100644 --- a/grape-swagger.gemspec +++ b/grape-swagger.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |s| s.metadata['rubygems_mfa_required'] = 'true' s.required_ruby_version = '>= 3.0' - s.add_runtime_dependency 'grape', '>= 1.7', '< 3.0' + s.add_runtime_dependency 'grape', '>= 2.2.0', '< 3.0' s.add_runtime_dependency 'rack-test', '~> 2' s.files = Dir['lib/**/*', '*.md', 'LICENSE.txt', 'grape-swagger.gemspec'] diff --git a/lib/grape-swagger/doc_methods/produces_consumes.rb b/lib/grape-swagger/doc_methods/produces_consumes.rb index 3359e4b6..eafd3f28 100644 --- a/lib/grape-swagger/doc_methods/produces_consumes.rb +++ b/lib/grape-swagger/doc_methods/produces_consumes.rb @@ -7,7 +7,7 @@ class << self def call(*args) return ['application/json'] unless args.flatten.present? - args.flatten.map { |x| Grape::ContentTypes::CONTENT_TYPES[x] || x }.uniq + args.flatten.map { |x| Grape::ContentTypes::DEFAULTS[x] || x }.uniq end end end diff --git a/lib/grape-swagger/endpoint.rb b/lib/grape-swagger/endpoint.rb index dd93f864..a5a38cd5 100644 --- a/lib/grape-swagger/endpoint.rb +++ b/lib/grape-swagger/endpoint.rb @@ -11,8 +11,8 @@ 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? - content_types = Grape::ContentTypes::CONTENT_TYPES.select do |content_type, _mime_type| + formats = Grape::Formatter::DEFAULTS.keys if formats.empty? + content_types = Grape::ContentTypes::DEFAULTS.select do |content_type, _mime_type| formats.include? content_type end.values end