makeplane / makeplane/plane-python-sdk
fix: WorkItemAttachments.create() raises ValidationError on actual Plane response
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 17
- Forks
- 24
- Ø Merge
- 8 T. 9 Std.
- Gemergte PRs (30 T.)
- 2
Beschreibung
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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne bei WorkItemAttachments.create() und dem WorkItemAttachment-Modell und vergleiche anschließend deren Validierungspfad mit der dokumentierten Plane-Wrapper-Antwort. Reproduziere den Aufruf mit WorkItemAttachmentUploadRequest und überprüfe, dass das Ergebnis sowohl den verschachtelten Attachment-Datensatz als auch upload_data ohne einen ValidationError enthält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- api
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 68/100