GET /v3/apps/:guid/routes accepts include but ignores it

未关闭 适合新手
#5,560 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
ruby
领域
api, backend

调研方向

从 app/controllers/v3/routes_controller.rb 中的 index_by_app 开始,并将其与 index 进行比较;index 已经会根据 message.include 应用装饰器。检查路由控制器中针对这两个端点的请求规格,以及 docs/v3/source/includes/resources/routes/_list_for_app.md.erb 中的端点文档。完成标准是:应用路由端点对有效的 include 参数的处理与通用路由端点保持一致,并且文档反映了这一行为。

由索引模型根据 Issue 内容生成。

描述

GET /v3/routes?include=domain returns the domains under included; GET /v3/apps/:guid/routes?include=domain returns 200 with no included at all.

Both actions build a RoutesListMessage, which allows and validates include (routes_list_message.rb:12,19):

validates_with IncludeParamValidator, valid_values: ['domain', 'space', 'space.organization', 'route_policies']

index turns it into decorators (routes_controller.rb:46-50):

decorators = []
decorators << IncludeRouteDomainDecorator if IncludeRouteDomainDecorator.match?(message.include)
decorators << IncludeSpaceDecorator if IncludeSpaceDecorator.match?(message.include)
decorators << IncludeOrganizationDecorator if IncludeOrganizationDecorator.match?(message.include)
decorators << IncludeRoutePoliciesDecorator if IncludeRoutePoliciesDecorator.match?(message.include)

index_by_app (routes_controller.rb:299-327) validates the same message and renders PaginatedListPresenter without decorators:, so a valid include is accepted and dropped.

The v3 docs for this endpoint don't list include (routes/_list_for_app.md.erb), so either fix is consistent with them: apply the same decorators in index_by_app (and document include), or reject include there. Applying them seems the expected behaviour, since every other route list supports it. Happy to send a PR for whichever you prefer.

Found with a contract check of the v3 docs, the OpenAPI spec and the request messages (see #5496).

主要语言
Ruby
星标
208
派生
374
平均合并
2 天 17 小时
30 天内合并 PR
78

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cloudfoundry/cloud_controller_ng 的其他 Issue

查看 cloudfoundry/cloud_controller_ng 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。