gitea
gitea copied to clipboard
/api/v1/repos/{o}/{repo}/labels does not apply pagination consistently
Description
- Pagination is not applied by default (is there a need for this wrt backwards compat?)
- 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.
- 91 results, questionable if
- https://gitea.com/api/v1/repos/lunny/gitea/labels?limit=60&page=1
- 50 results, reasonable if
MAX_RESPONSE_ITEMS = 50
- 50 results, reasonable if
- 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
- 30 results, reasonable if
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.