API: list_columns returns num_issues: null — per-column issue counts not populated #5

Closed
opened 2026-05-15 21:28:37 +03:00 by oleks · 1 comment
Owner

Context

GET /api/v1/users/{username}/-/projects/{id}/columns (and the org/repo equivalents) returns a num_issues field on each column, but the value is always null.

Example response payload for a real column with 8 open issues:

{
  "id": 27,
  "title": "High Priority",
  "project_id": 7,
  "num_issues": null,
  "default": false,
  ...
}

Impact

  • Dashboards and CLI summaries that want to show "Backlog (20) · Triage (5) · HP (8)" cannot rely on the column-list response.
  • The only way to get per-column counts is to call list_column_issues N times (once per column) and count locally. For a 5-column board, that's 1 + 5 = 6 round trips instead of 1.

Proposed fix

Populate num_issues in the column-list response with the count of issues attached to the column. Bonus: also expose num_open_issues / num_closed_issues to mirror the shape on the project-list response, which already breaks counts out by state.

Workaround

Call list_column_issues per column and count client-side.

## Context `GET /api/v1/users/{username}/-/projects/{id}/columns` (and the org/repo equivalents) returns a `num_issues` field on each column, but the value is always `null`. Example response payload for a real column with 8 open issues: ```json { "id": 27, "title": "High Priority", "project_id": 7, "num_issues": null, "default": false, ... } ``` ## Impact - Dashboards and CLI summaries that want to show "Backlog (20) · Triage (5) · HP (8)" cannot rely on the column-list response. - The only way to get per-column counts is to call `list_column_issues` N times (once per column) and count locally. For a 5-column board, that's 1 + 5 = 6 round trips instead of 1. ## Proposed fix Populate `num_issues` in the column-list response with the count of issues attached to the column. Bonus: also expose `num_open_issues` / `num_closed_issues` to mirror the shape on the project-list response, which already breaks counts out by state. ## Workaround Call `list_column_issues` per column and count client-side.
oleks added this to the (deleted) project 2026-05-15 21:29:24 +03:00
Author
Owner

PR up: #6num_issues is now populated on all three column-list endpoints, plus num_open_issues and num_closed_issues to mirror the shape of Project. Implementation is ColumnList.LoadIssueCounts in models/project/column_list.go: two grouped queries against project_issue ⋈ issue (one open, one closed), so a 5-column board takes 2 round trips at the DB level regardless of column count.

omitempty was dropped on these three JSON fields — a column with 0 issues now serializes as 0 rather than disappearing, which is what callers building "Backlog (20) · Triage (5) · HP (8)" summaries actually want.

Not merging yet — the patched Gitea is the same instance hosting this issue.

PR up: #6 — `num_issues` is now populated on all three column-list endpoints, plus `num_open_issues` and `num_closed_issues` to mirror the shape of `Project`. Implementation is `ColumnList.LoadIssueCounts` in `models/project/column_list.go`: two grouped queries against `project_issue ⋈ issue` (one open, one closed), so a 5-column board takes 2 round trips at the DB level regardless of column count. `omitempty` was dropped on these three JSON fields — a column with 0 issues now serializes as `0` rather than disappearing, which is what callers building "Backlog (20) · Triage (5) · HP (8)" summaries actually want. Not merging yet — the patched Gitea is the same instance hosting this issue.
oleks closed this issue 2026-05-15 22:00:51 +03:00
oleks moved this to Closed in My issues on 2026-05-15 22:08:23 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: oleks/gitea#5