JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
Default fields resource option
未关闭
还没有人认领这个 Issue。
Type: Enhancement
- 主要语言
- Ruby
- 星标
- 2.3k
- 派生
- 546
- PR 合并指标
- 30 天内没有已合并 PR
描述
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?
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先定位资源类选项处理以及 issue 中提到的请求解析器。跟踪请求的字段和关系是如何被选择的,然后确定默认列表应如何仅在字段缺失时应用。完成的标准是资源可以声明默认字段,被省略的关系默认排除,并且显式请求的字段仍然有效。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- rails, ruby
- 领域
- api, backend
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100