fix: WorkItemAttachments.create() raises ValidationError on actual Plane response
まだ誰も着手していません。
評価
調査の方向性
WorkItemAttachments.create() と WorkItemAttachment モデルから始め、次にそれらのバリデーションパスを、文書化されている Plane wrapper のレスポンスと比較してください。WorkItemAttachmentUploadRequest を使って呼び出しを再現し、結果がネストされた attachment レコードと upload_data の両方を ValidationError なしで公開することを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Calling client.work_items.attachments.create(...) against a live Plane instance raises:
pydantic.ValidationError: 1 validation error for WorkItemAttachment
asset
Field required [type=missing, input_value={'upload_data': {...}, 'asset_id': '...', 'attachment': {...}, 'asset_url': '...'}, input_type=dict]
Plane returns a wrapper response, not a flat WorkItemAttachment:
{
"upload_data": { "url": "...", "fields": { "...S3 multipart policy..." } },
"asset_id": "427e...",
"attachment": { "id": "427e...", "asset": "ws/uuid-name.ext", "is_uploaded": false, ... },
"asset_url": "/api/assets/v2/.../attachments/427e.../"
}
But WorkItemAttachments.create() calls WorkItemAttachment.model_validate(response) directly on the wrapper — WorkItemAttachment is actually nested inside response["attachment"]. Hence the missing-asset validation error.
Reproduction:
from plane import PlaneClient
from plane.models.work_items import WorkItemAttachmentUploadRequest
client = PlaneClient(api_key="<key>", base_url="https://your-plane.example.io")
client.work_items.attachments.create(
workspace_slug="ws", project_id="<uuid>", work_item_id="<uuid>",
data=WorkItemAttachmentUploadRequest(name="x.txt", size=10),
)
# raises pydantic.ValidationError
Suggested fix: add a new WorkItemAttachmentCreateResponse model capturing the full wrapper and change WorkItemAttachments.create() to return it. Exposes both the attachment record and the upload data the caller needs for the S3 multipart
POST.
PR coming.
- 主要言語
- Python
- スター
- 17
- フォーク
- 24
- 平均マージ
- 8日 9時間
- マージ済み PR(30日)
- 2
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
makeplane/plane-python-sdk のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
makeplane/plane-python-sdk の issue をすべて見る
似ている issue
-
Add: hunch オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
DiamondLightSource/dodal#2211 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
openml/openml-python#1749 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
sipyourdrink-ltd/bernstein#6191 ·