API Platform ignores array shapes in the JSON Schema
维护者通常 1 天内回复
评估
调研方向
首先找到 getJsonSchemaFromType(),并追踪它如何处理 CollectionType;issue 指出该方法最有可能是检查数组结构的地方。确认 PHPDoc array{total: int, processed: int, failed: int} 当前是如何表示的,然后将生成的 schema 与示例中的命名字段进行比较。完成标准是 schema 保留结构中的每个字段及其类型。
由索引模型根据 Issue 内容生成。
描述
Description
A property documented with a PHPDoc array shape generates a schema without its field names. The shape becomes a generic map whose value type is the union of all field types. Here you see it going different from what we expect and hope for:
/** @var array{total: int, processed: int, failed: int} */
public array $totals = [];
Example
Before:
totals: { [key: string]: number }
After:
totals: {
total: number
processed: number
failed: number
}
I could drop the whole cause and suggested AI fix here, but don't think anyone wants that...
The gist is, possibly add it in getJsonSchemaFromType(), before the CollectionType branch with if ($type instanceof ArrayShapeType) .
- 主要语言
- PHP
- 星标
- 2.6k
- 派生
- 987
- 平均合并
- 2 天 5 小时
- 30 天内合并 PR
- 73
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
api-platform/core 的其他 Issue
-
SortFilter generates unsupported array form for parameters可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
api-platform/core#8744 ·
维护者通常 1 天内回复
-
JSON:API: resource schemas (`*.jsonapi`) have `properties` but no `type: object`可能已有人在做 @ousamabenyounes 于 17 天前认领。 未关闭
难度 2/5 1 小时以内 新手友好度 80/100
api-platform/core#8701 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
api-platform/core#8771 ·
维护者通常 1 天内回复
-
Doctrine ORM/ODM resource metadata collection factory runs outside the metadata cache since 4.2.16 (priority -50 vs `.cached` at -10)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
api-platform/core#8769 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 20/100
api-platform/core#8765 · 1 条评论 ·
维护者通常 1 天内回复
查看 api-platform/core 的全部 Issue
相似的 Issue
-
fixed
难度 2/5 1-3 小时 新手友好度 62/100
firefly-iii/firefly-iii#13150 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
TYPO3-Solr/ext-solr#4828 ·
维护者通常 5 天内回复
-
sync-en
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
Перевод устарел
难度 2/5 1-3 小时 新手友好度 68/100
-
needs triage
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复