makeplane / makeplane/plane-python-sdk
fix: WorkItemAttachments.create() raises ValidationError on actual Plane response
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 17
- Fork
- 24
- Merge trung bình
- 8 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 2
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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
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.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 68/100