JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
Default fields resource option
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
Add an option to the resource class to specify the default fields. Would be used by the request parser if the fields are not specified. Would allow a pared down fields set as the default, while still allowing the full field set if requested.
For example:
class CommentResource < JSONAPI::Resource
attributes :body
has_one :post
has_one :author, class_name: 'Person'
has_many :tags
filters :body
default_fields [:body, :post, :author]
end
Would skip the tags relationship, unless specified in the request.
Comments?
Contributor guide
No contributing guide indexed for this repository
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 by locating the resource class option handling and the request parser mentioned in the issue. Trace how requested fields and relationships are selected, then determine how a default list should apply only when fields are absent. Done means resources can declare default fields, omitted relationships are excluded by default, and explicitly requested fields still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100