ruby-grape / grape-entity

An API focused facade that sits on top of an object model.
MIT License
721 stars 153 forks source link

Custom Entity options support #382

Open pavelbabin opened 8 months ago

pavelbabin commented 8 months ago

It would be great to be able to provide custom options for entity exposure like:

expose :name, custom: { key: 'value' }

Not only option named custom but any other name as well. It might be helpful sometimes

Now such custom options not allowed ant an exception is throwing:

/gems/grape-entity-1.0.0/lib/grape_entity/entity.rb:624:in `block in valid_options': :custom is not a valid option. (ArgumentError):

 raise ArgumentError, "#{key.inspect} is not a valid option." unless OPTIONS.include?(key)