makeplane / makeplane/plane-python-sdk
fix: WorkItemAttachments.create() raises ValidationError on actual Plane response
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17
- Forks
- 24
- Avg merge
- 8d 9h
- Merged PRs (30d)
- 2
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at WorkItemAttachments.create() and the WorkItemAttachment model, then compare their validation path with the documented Plane wrapper response. Reproduce the call using WorkItemAttachmentUploadRequest and verify that the result exposes both the nested attachment record and upload_data without a ValidationError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100