jdalrymple / gitbeaker

🦊🧪 A comprehensive and typed Gitlab SDK for Node.js, Browsers, Deno and CLI
Other
1.5k stars 283 forks source link

Keyset Pagination not working with sort: 'dec', API seems to expect 'desc' instead #3565

Closed timvahlbrock closed 2 months ago

timvahlbrock commented 3 months ago

Description

I tried to fetch Project Jobs using the keyset pagination but kept getting 405s. To verify, I replayed the request manually using ThunderClient and got the same response but the additional info "Keyset pagination is not yet available for this type of request". The GitLab API Documentation says that sort should be "asc" or "desc", not "dec" like it's used in the types of gitbeaker. After changing the value of sort, the request worked fine. Also reproduced with Pipelines Endpoint, however the pipelines endpoint throws a 400 error with "sort does not have a valid value" instead, as its keysets requests are less restricted. Maybe it would be good if the "error" property would be exposed to the caller in general.

Steps to reproduce

Perform any request with keyset pagination and sort "dec", try again with "desc". Note that this is currently the only keyset request configuration Gitlab supports. Sample request:

  const jobs = await gitlab.Jobs.all(123456, {
      pagination: "keyset",
      sort: "dec",
      orderBy: "id"
  });

Expected behaviour

Request should be fine.

Actual behaviour

Request throws 405 Method not allowed.

Possible fixes

Replace "dec" with "desc".

Checklist

jdalrymple commented 3 months ago

Overlooked typo! Good catch

jdalrymple commented 2 months ago

:rocket: Issue was released in 40.0.3 :rocket: