Skip to content

grape 2.2.0 is incompatible with grape-rabl #53

Description

@znz

grape-rabl 0.5.0 uses Grape::Formatter.formatter_for with one argument.

def fallback_formatter
Grape::Formatter.formatter_for(env[Grape::Env::API_FORMAT])

But grape 2.2.0 changed its arity.

ruby-grape/grape@v2.1.3...v2.2.0#diff-2332fb7b55e286e39346d06d8427673ae0dade2d41786327b23375cc30ef2ffaR17

So wrong number of arguments (given 1, expected 2) raised.

In our application, following monkey patch resolved the exception.

module Grape
  module Formatter
    module_function

    def formatter_for(api_format, formatters=nil)
      select_formatter(formatters, api_format) || DEFAULT_LAMBDA_FORMATTER
    end
  end
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions