representable icon indicating copy to clipboard operation
representable copied to clipboard

Using the :skip_parse option with JSON::Hash values produces Pipeline::Stop

Open jpsikorra opened this issue 7 years ago • 1 comments

Using the option :skip_parse with values will set Representable::Pipeline::Stop on the represented object. I expected it to be nil.

class SomeRepresenter < Grape::Roar::Decorator
  include Roar::JSON
  include Roar::Coercion
  include Representable::JSON::Hash

  values skip_parse: ->(fragment:,**) { fragment.nil? }
end
SomeRepresenter.new(Hash.new).from_hash('foo' => nil)
#=> {"foo"=>Representable::Pipeline::Stop}

jpsikorra avatar Mar 14 '18 09:03 jpsikorra

Hi @jpsikorra I kind of gave up on Representable, we will soon publish transform which will suit all your needs (FYI).

apotonick avatar Mar 14 '18 10:03 apotonick