makeplane / makeplane/plane-python-sdk

WorkItemDetail.labels validation fails when API returns unexpanded label IDs

Abierto Apto para principiantes
#60 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Python
Estrellas
17
Forks
24
Merge medio
8 d 9 h
PR fusionados (30 d)
2

Descripción

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.ValidationErrorInput 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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Encuentra el modelo WorkItemDetail en el SDK y reproduce el fallo mediante work_items.retrieve sin expand=labels. Verifica que labels acepte tanto las cadenas de ID de label no expandidas de la API como los objetos Label expandidos, y confirma que las rutas retrieve_work_item ya no generen ValidationError.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
api
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
68/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.