makeplane / makeplane/plane-python-sdk
WorkItemDetail.labels validation fails when API returns unexpanded label IDs
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 17
- フォーク
- 24
- 平均マージ
- 8日 9時間
- マージ済み PR(30日)
- 2
説明
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.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
SDK 内の WorkItemDetail モデルを見つけ、expand=labels なしで work_items.retrieve を通じて失敗を再現します。labels が API の展開されていない label ID 文字列と展開された Label オブジェクトの両方を受け入れることを検証し、retrieve_work_item のパスで ValidationError が発生しなくなったことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 68/100