WorkItemDetail.labels validation fails when API returns unexpanded label IDs

Aperta Adatta ai principianti
#60 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 5 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
python
Ambito
api

Direzione di ricerca

Trova il modello WorkItemDetail nell’SDK e riproduci il fallimento tramite work_items.retrieve senza expand=labels. Verifica che labels accetti sia le stringhe di ID delle label non espanse dell’API sia gli oggetti Label espansi, e conferma che i percorsi retrieve_work_item non generino più ValidationError.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

work_items.retrieve() (and any code path returning a WorkItemDetail) raises a pydantic.ValidationError for any work item that has labels attached, when labels is not explicitly expanded.

Repro

Call the retrieve endpoint for a work item that has one or more labels, without expand=labels:

client.work_items.retrieve(
    workspace_slug=workspace_slug,
    project_id=project_id,
    work_item_id=work_item_id,
)

Result: pydantic.ValidationError — Input should be a valid dictionary or instance of Label — deterministic, not intermittent, for every work item that has labels.

Root cause

The Plane API returns labels as an array of label ID strings when the field isn't expanded (the normal/default response shape). The WorkItemDetail model types labels as list[Label] unconditionally, so pydantic rejects the plain ID strings instead of accepting either shape.

Expected behavior

labels should accept both shapes depending on whether the caller expanded it — e.g. list[Label] | list[str], or the model should coerce string IDs into a minimal Label reference, consistent with how the API actually behaves when expand isn't requested.

Environment

  • plane-sdk==0.2.19 (PyPI)
  • Found via makeplane/plane-mcp-server (retrieve_work_item / retrieve_work_item_by_identifier tools), but the bug is in the SDK's model, not the MCP server.
  • Server tested against: self-hosted Plane Community 1.3.1.

Workaround in use

Using list_work_items (which doesn't hit this validation path) instead of retrieve_work_item*, and filtering client-side.

Lingua principale
Python
Stelle
18
Fork
30
Merge medio
5g 6h
PR unite (30g)
7

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di makeplane/plane-python-sdk

Tutte le issue di makeplane/plane-python-sdk

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.