Skip to content

Grape 1.6.1 throughs an error on Grape::Validations::Types.group?() #2214

Closed
@mobilutz

Description

@mobilutz

The patch upgrade from 1.6.0 to 1.6.1 is breaking on the following line for me:
https://github.com/ruby-grape/grape/blob/v1.6.1/lib/grape/dsl/parameters.rb#L154

The full error is:

An error occurred while loading ./spec/riskmethods/jsonapi/validations_spec.rb.
Failure/Error:
  optional :hash, type: ::Hash, strict_hash: true do
    optional :nested
  end

NoMethodError:
  undefined method `group?' for Grape::Validations::Types:Module
# ./vendor/bundle/ruby/2.7.0/gems/grape-1.6.1/lib/grape/dsl/parameters.rb:154:in `optional'

Even though, def self.group?() is defined on Types here, I cannot call it through IRB or any other other means:
https://github.com/ruby-grape/grape/blob/v1.6.1/lib/grape/validations/types.rb#L101-L108

Looking through our specs, I also find this error:

NoMethodError:
  undefined method `multiple?' for Grape::Validations::Types:Module
# ./vendor/bundle/ruby/2.7.0/gems/grape-1.6.1/lib/grape/validations/params_scope.rb:359:in `infer_coercion'

The test setup is as follows:

  1. create a RSpec support app with some endpoints and optional params e.g.
       params do
         optional :hash, type: ::Hash, strict_hash: true do
           optional :nested
         end
       end
    
       get :strict_hash do
         ...
       end
    
  2. call that endpoint in specs
  3. see error from grape 😦

PS: In my opinion, the patch update has way to many changes in it to be honest. But I also know how hard maintaining an open-source product is, so please don't take this as a complaint!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions