ruby-grape / ruby-grape/grape-entity

Discussion on how to handle reopening exposures.

Open
#64 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature question
Dominant language
Ruby
Stars
729
Forks
154
PR merge metrics
No merged PRs in 30d

Description

Example.

class Person < Grape::Entity
  expose :user do
    expose(:in_first) { |_| 'value' }
  end
end

class Student < Person
  expose :user do
    expose(:user_id) { |_| 'value' }
    expose(:user_display_id, as: :display_id) { |_| 'value' }
  end
end
  • Current behaviour is that both exposures are merged.
  • @dblock expressed his concern that this does not follow the same logic as redefining a method: The old method gets overwritten; so if you want to call it, you would use super.

related: https://github.com/intridea/grape-entity/pull/63

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation file or test is named. Start by reading the exposure-inheritance example and related pull request #63, then establish whether reopening should merge exposures or replace them; the issue is done only once the project agrees on the behavior and its expected coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.