Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of Skip and Start parameters for pagination #98

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

andygrunwald
Copy link
Owner

The way how we handle pagination is not optimal, partially broken, and sometimes even inconsistent with the current (v3.4.1) Gerrit REST API docs.

Not optimal
Parameters are defined as strings in some Options.
It should be an integer.

Partially broken
In some calls, you can set a Skip and Start parameters.
On Gerrit Server Side this is causing a (we assume) undefined behavior.
However, the call with both parameters s and start set will not succeed.

Inconsistent with the current (v3.4.1) Gerrit REST API docs
In the Gerrit docs, the setting is sometimes named Start. Sometimes Skip.
On go-gerrit side, we use kinda both and something the other version per call.

This Pull Request is ...

  • Fixing and unifying the Start/Skip behavior
  • Being consistent with the Gerrit REST API docs
  • Adding examples on how to use the functionality

Breaking change

This PR is introducing a breaking change.
I believe it is worth doing it, because

  1. We aim to provide a Migration path
  2. Pagination is a common and important functionality, especially on bigger instances
  3. The breaking change doesn't require a huge amount of modification

Special notice

This PR is a follow-up from the work of @michaeldorner in #48.

After the merge

I aim to create a new library release including a migration guide for people who are adopting this library.

The way we treated Skip and Start parameters was inconsistent and wrong.
In some calls we send both parameters (s, start, S). This causes
and undefined behaviour at Gerrit itself.

Additional the Skip/Start parameters are numbers and not strings.
Here we fixed the Go types.

Thanks a lot to @michaeldorner for his initial work in #48

Related:
- #48
@andygrunwald
Copy link
Owner Author

@dmitshur @opalmer I would love to get your quick feedback on this.

* master:
  Groups: Add _more_groups attribute to GroupInfo
  Fix #92: Add pagination support for SuggestAccount
@andygrunwald
Copy link
Owner Author

@dmitshur If you find some spare time, it would be great to get your pair of eyes and a bit of feedback. Thanks mate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant