grape: Grape 1.6.1 throughs an error on `Grape::Validations::Types.group?()`
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:
- 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 - call that endpoint in specs
- 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!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 15 (11 by maintainers)
Upgrading to 1.6.2 fixed the related issue https://github.com/ruby-grape/grape/issues/2218 - thank you!
1.6.2 has been released, try updating 🤞🏻
Thanks @dm1try
Sorry for the late reply, I was out all day. I’ll take a look tomorrow and let you know.
On Wed 29 Dec 2021 at 22:52 Lutz Lengemann @.***> wrote:
– Avertissement Ce message est destiné uniquement à la personne ou à l’organisation à laquelle il est adressé et il peut contenir des informations privilégiées, confidentielles ou non divulgables en vertu de la loi. Si vous n’êtes pas le destinataire du présent message ni la personne chargée de remettre le présent message à son destinataire, il vous est strictement interdit de le divulguer, de le distribuer, de le copier ou de l’utiliser de quelque façon que ce soit. Si vous avez reçu la présente communication par erreur, veuillez en aviser l’expéditeur et détruire ou effacer tous les exemplaires que vous avez reçus. *Warning *This message is intended only for the use of the individual or entity to which it is addressed, and may contain information which is privileged, confidential, proprietary or exempt from disclosure under applicable law. If you are not the intended recipient or the person responsible for delivering the message to the intended recipient, you are strictly prohibited from disclosing, distributing, copying or in any way using this message. If you have received this communication in error, please notify the sender, and destroy and delete any copies you may have received.
@mobilutz meanwhile, as a workaround, you could put
in the spec helper
but I’m hoping for a quick fix release 😃