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 pagination documentation for stellar-rpc #1363

Merged
merged 2 commits into from
Mar 7, 2025
Merged

Fix pagination documentation for stellar-rpc #1363

merged 2 commits into from
Mar 7, 2025

Conversation

tamirms
Copy link
Contributor

@tamirms tamirms commented Mar 6, 2025

Fixes #1309

This PR consolidates the documentation for pagination that is used for getEvents, getTransactions, and getLedgers. All those endpoints use a cursor field in the request / response in order to do pagination.

The cursor field used to be called paging_token and this PR updates the documentation to reference cursor instead of paging_token.

Also, the cursor field was missing in the schema of the getEvents and getTransactions responses. This PR includes the cursor fields in those responses.

@stellar-jenkins
Copy link

Something went wrong with PR preview build please check

@stellar-jenkins
Copy link

Something went wrong with PR preview build please check

@stellar-jenkins
Copy link

@stellar-jenkins
Copy link

@stellar-jenkins
Copy link

Copy link
Contributor

@Shaptic Shaptic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! You need to regenerate the "compiled" RPC spec, though:

yarn rpcspec:build

@@ -39,7 +39,7 @@
},
"cursor": {
"type": "string",
"$ref": "#/components/schemas/GetEventsCursor"
"$ref": "#/components/schemas/Cursor"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each event itself also has a cursor - I think that needs to be updated, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the event schema the field is still called pagingToken:

https://github.com/stellar/stellar-rpc/blob/main/protocol/get_events.go#L29-L30

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh oof, gotcha. That one is still useful for mid-page eventing, though, so idk if deprecated is the word? Then again they should use id for that.

@stellar-jenkins
Copy link

@tamirms
Copy link
Contributor Author

tamirms commented Mar 7, 2025

@Shaptic can you take another look? I updated the pr with the following changes:

  • ran yarn rpcspec:build
  • added a note to the pagingToken field within the event schema that it's deprecated in favor of the top level cursor
  • fixed the link to the pagination page (previously it was hardcoded to the developers.stellar.org domain)

@tamirms tamirms merged commit 34029f1 into main Mar 7, 2025
2 checks passed
@tamirms tamirms deleted the rpc-cursor branch March 7, 2025 19:27
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.

RPC schema: Pagination declared twice
3 participants