makeplane / makeplane/plane-python-sdk

fix: WorkItemAttachments.create() raises ValidationError on actual Plane response

オープン
#33 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
17
フォーク
24
平均マージ
8日 9時間
マージ済み PR(30日)
2

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

WorkItemAttachments.create() と WorkItemAttachment モデルから始め、次にそれらのバリデーションパスを、文書化されている Plane wrapper のレスポンスと比較してください。WorkItemAttachmentUploadRequest を使って呼び出しを再現し、結果がネストされた attachment レコードと upload_data の両方を ValidationError なしで公開することを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。