[PR #1988] [MERGED] fix: ensure API consistency for /tasks and empty array responses #9690

Closed
opened 2026-04-23 09:09:16 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/1988
Author: @kolaente
Created: 12/15/2025
Status: Merged
Merged: 12/15/2025
Merged by: @kolaente

Base: mainHead: fix-tasks-all-inconsistency


📝 Commits (2)

  • d618ac7 fix: rename /tasks/all endpoint to /tasks for API consistency
  • 47f3529 fix: return empty array instead of null for empty pagination results

📊 Changes

5 files changed (+15 additions, -7 deletions)

View changed files

📝 frontend/src/services/task.ts (+1 -1)
📝 pkg/models/tasks.go (+1 -1)
📝 pkg/routes/routes.go (+1 -1)
📝 pkg/web/handler/read_all.go (+8 -0)
📝 pkg/webtests/api_tokens_test.go (+4 -4)

📄 Description

Summary

  • Renames the /tasks/all endpoint to /tasks for consistency with other collection endpoints like /projects and /labels
  • Returns [] instead of null for empty pagination results across all list endpoints
  • Updates the frontend service to use the new endpoint path
  • Updates API token tests to use the new endpoint path

The empty array fix is implemented in the generic ReadAllWeb handler using reflection to detect nil slices wrapped in interface{} (a Go gotcha where an interface containing a nil slice is not equal to nil itself).

Fixes #1984

Test plan

  • Verify /api/v1/tasks returns all tasks the user has access to
  • Verify empty results return [] not null for all endpoints:
    • /tasks, /labels, /teams, /notifications, /tokens
    • /projects/:id/shares, /projects/:id/tasks, /projects/:id/teams, /projects/:id/users, /projects/:id/webhooks
  • Run existing tests to ensure no regressions

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/1988 **Author:** [@kolaente](https://github.com/kolaente) **Created:** 12/15/2025 **Status:** ✅ Merged **Merged:** 12/15/2025 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix-tasks-all-inconsistency` --- ### 📝 Commits (2) - [`d618ac7`](https://github.com/go-vikunja/vikunja/commit/d618ac79d42401687fbc6353f4dfa5d24281787d) fix: rename /tasks/all endpoint to /tasks for API consistency - [`47f3529`](https://github.com/go-vikunja/vikunja/commit/47f35293a602168f7ccbe734404073330741e3ea) fix: return empty array instead of null for empty pagination results ### 📊 Changes **5 files changed** (+15 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/services/task.ts` (+1 -1) 📝 `pkg/models/tasks.go` (+1 -1) 📝 `pkg/routes/routes.go` (+1 -1) 📝 `pkg/web/handler/read_all.go` (+8 -0) 📝 `pkg/webtests/api_tokens_test.go` (+4 -4) </details> ### 📄 Description ## Summary - Renames the `/tasks/all` endpoint to `/tasks` for consistency with other collection endpoints like `/projects` and `/labels` - Returns `[]` instead of `null` for empty pagination results across all list endpoints - Updates the frontend service to use the new endpoint path - Updates API token tests to use the new endpoint path The empty array fix is implemented in the generic `ReadAllWeb` handler using reflection to detect nil slices wrapped in `interface{}` (a Go gotcha where an interface containing a nil slice is not equal to `nil` itself). Fixes #1984 ## Test plan - [x] Verify `/api/v1/tasks` returns all tasks the user has access to - [x] Verify empty results return `[]` not `null` for all endpoints: - `/tasks`, `/labels`, `/teams`, `/notifications`, `/tokens` - `/projects/:id/shares`, `/projects/:id/tasks`, `/projects/:id/teams`, `/projects/:id/users`, `/projects/:id/webhooks` - [x] Run existing tests to ensure no regressions --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 09:09:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#9690