fix: implement cursor pagination with JSON body (body_json)#1693
Open
sergibeltran wants to merge 1 commit into
Open
fix: implement cursor pagination with JSON body (body_json)#1693sergibeltran wants to merge 1 commit into
sergibeltran wants to merge 1 commit into
Conversation
Cursor pagination for POST APIs that require the next page token inside the JSON body always returned the first page because the body_json pagination param type was declared but never implemented. This implements it (the cursor value is injected into the request JSON body), exposes the option in the query editor, and stops cursor pagination from erroring when the final page omits the cursor field. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When paginating a POST API with cursor pagination where the
nextPageTokencursor must be sent inside the JSON request body, Infinity always returned the first page. Thebody_jsonpagination param type was declared in the models but never implemented — the cursor was appended as a query parameter instead of being injected into the body, so every request was identical.Changes
body_jsonpagination param type inApplyPaginationItemToQuery: the cursor key/value is merged into the request JSON body (guarded so a non-JSON body is left untouched rather than overwritten).error while extracting the cursor valueand failed the whole query. This is now treated as "no more pages".Testing
body_jsoninjection (empty body, existing body, overwrite existing key, non-JSON body left untouched).go test ./...,go vet,yarn typecheck,yarn lint,yarn test:ciandyarn spellcheckall pass./rest/api/3/search/jql) paginating 3500+ records vianextPageTokenin the JSON body.