gitea icon indicating copy to clipboard operation
gitea copied to clipboard

/api/v1/repos/{o}/{repo}/labels does not apply pagination consistently

Open noerw opened this issue 3 years ago • 0 comments

Description

  1. Pagination is not applied by default (is there a need for this wrt backwards compat?)
  2. Pagination is only applied when &page= param is set, setting &limit= is not enough.

This behaviour is inconsistent with other APIs. Try the following examples. The example repo currently has 91 labels:

  • https://gitea.com/api/v1/repos/lunny/gitea/labels
    • 91 results, questionable if MAX_RESPONSE_ITEMS = 50, but probably for backwards compat reasons.
  • https://gitea.com/api/v1/repos/lunny/gitea/labels?limit=60&page=1
    • 50 results, reasonable if MAX_RESPONSE_ITEMS = 50
  • https://gitea.com/api/v1/repos/lunny/gitea/labels?limit=60
    • 91 results, certainly wrong
  • https://gitea.com/api/v1/repos/lunny/gitea/labels?page=1
    • 30 results, reasonable if DEFAULT_PAGING_NUM = 30, though strange UX

See also #16733. This problem originally came up in: https://gitea.com/gitea/tea/issues/463

Gitea Version

1.18.0+dev-333-g9e0c43777 (9e0c43777) but the bug is much older than that.

noerw avatar Sep 13 '22 15:09 noerw