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

Đang mở
#33 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 5 ngày

@volodchenkov đang làm issue này rồi.

Từ ngày 5/5/2026.

  • #34 của @volodchenkov — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu từ WorkItemAttachments.create() và model WorkItemAttachment, sau đó so sánh đường dẫn validation của chúng với phản hồi Plane wrapper được ghi trong tài liệu. Tái hiện lời gọi bằng WorkItemAttachmentUploadRequest và xác minh rằng kết quả hiển thị cả bản ghi attachment lồng nhau và upload_data mà không có ValidationError.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
18
Fork
30
Merge trung bình
5 ngày 6 giờ
Pull request đã merge (30 ngày)
7

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của makeplane/plane-python-sdk

Tất cả issue của makeplane/plane-python-sdk

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.