ruby-grape / ruby-grape/grape-entity
Inheritance issue with the grape-entity version >= 0.5.0
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 729
- Forks
- 154
- PR merge metrics
- No merged PRs in 30d
Description
module API
module V1
module Entities
class A < Grape::Entity
expose :k
expose :l
expose :status
def status
'HI'
end
end
end
end
end
module API
module V101
module Entities
class A < V1::Entities::A
expose :status
def status
'BYE'
end
end
end
end
end
In this case, when I am calling the V101 it is calling the status function of V1 instead of the V101 at first. This means - first it is executing the status function of v1 and then v101. This code perfectly works with the grape-entity version = 0.4.8 where it only calls the function of v101 when I call with v101. After version >= 0.5 this code does not behave as before. Ami I missing something? Thank you!
Related Configuration
rails: 5.2
grape: 1.6.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the two entity definitions in the issue and compare behavior between grape-entity 0.4.8 and 0.5.0 or later, focusing on inherited expose/status resolution. Done means calling V101 invokes only V101's status implementation while preserving the listed exposed fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100