WorkItemDetail.labels validation fails when API returns unexpanded label IDs
维护者通常 5 天内回复
还没有人认领这个 Issue。
评估
调研方向
在 SDK 中找到 WorkItemDetail 模型,并在不使用 expand=labels 的情况下通过 work_items.retrieve 重现该失败。验证 labels 同时接受 API 未展开的标签 ID 字符串和已展开的 Label 对象,并确认 retrieve_work_item 路径不再引发 ValidationError。
由索引模型根据 Issue 内容生成。
描述
Summary
work_items.retrieve() (and any code path returning a WorkItemDetail) raises a pydantic.ValidationError for any work item that has labels attached, when labels is not explicitly expanded.
Repro
Call the retrieve endpoint for a work item that has one or more labels, without expand=labels:
client.work_items.retrieve(
workspace_slug=workspace_slug,
project_id=project_id,
work_item_id=work_item_id,
)
Result: pydantic.ValidationError — Input should be a valid dictionary or instance of Label — deterministic, not intermittent, for every work item that has labels.
Root cause
The Plane API returns labels as an array of label ID strings when the field isn't expanded (the normal/default response shape). The WorkItemDetail model types labels as list[Label] unconditionally, so pydantic rejects the plain ID strings instead of accepting either shape.
Expected behavior
labels should accept both shapes depending on whether the caller expanded it — e.g. list[Label] | list[str], or the model should coerce string IDs into a minimal Label reference, consistent with how the API actually behaves when expand isn't requested.
Environment
plane-sdk==0.2.19(PyPI)- Found via
makeplane/plane-mcp-server(retrieve_work_item/retrieve_work_item_by_identifiertools), but the bug is in the SDK's model, not the MCP server. - Server tested against: self-hosted Plane Community 1.3.1.
Workaround in use
Using list_work_items (which doesn't hit this validation path) instead of retrieve_work_item*, and filtering client-side.
- 主要语言
- Python
- 星标
- 18
- 派生
- 30
- 平均合并
- 5 天 6 小时
- 30 天内合并 PR
- 7
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
makeplane/plane-python-sdk 的其他 Issue
-
[bug]: update() strips None values via exclude_none=True, making it impossible to clear nullable fields可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 4/5 3-5 天 新手友好度 45/100
makeplane/plane-python-sdk#35 ·
维护者通常 5 天内回复
-
fix: WorkItemAttachments.create() raises ValidationError on actual Plane response可能已有人在做 @volodchenkov 于 207 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
makeplane/plane-python-sdk#33 ·
维护者通常 5 天内回复
-
难度 5/5 一周以上 新手友好度 15/100
makeplane/plane-python-sdk#21 ·
维护者通常 5 天内回复
-
难度 5/5 一周以上 新手友好度 15/100
makeplane/plane-python-sdk#20 ·
维护者通常 5 天内回复
-
难度 3/5 1-2 天 新手友好度 45/100
makeplane/plane-python-sdk#15 ·
维护者通常 5 天内回复
查看 makeplane/plane-python-sdk 的全部 Issue
相似的 Issue
-
bug harness
难度 2/5 1-3 小时 新手友好度 72/100
mruangutai/harness#2687 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
modal-labs/modal-client#4158 ·
-
good first issue
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 半天 新手友好度 72/100
The-Swarm-Corporation/swarms-rs#168 ·
维护者通常 1 天内回复
-
[BUG] SMTP listener now binds to EMAIL_PORT instead of 2525 since the gunicorn switch 5.0.3-ls373未关闭
难度 2/5 1-3 小时 新手友好度 72/100
linuxserver/docker-healthchecks#137 · 1 条评论 ·