Skip to content

Commit

Permalink
Fix pagination documentation for stellar-rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirms committed Mar 6, 2025
1 parent 7fbd6e4 commit eae3ac8
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 37 deletions.
13 changes: 2 additions & 11 deletions openrpc/src/stellar-rpc/contentDescriptors/Pagination.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
{
"EventsPagination": {
"Pagination": {
"name": "pagination",
"summary": "pagination options",
"description": "Pagination in stellar-rpc is similar to pagination in Horizon. See [Pagination](https://developers.stellar.org/docs/data/rpc/api-reference/pagination).",
"required": false,
"schema": {
"$ref": "#/components/schemas/EventsPagination"
}
},
"TransactionsPagination": {
"name": "pagination",
"summary": "pagination options",
"description": "Pagination in RPC is similar to pagination in Horizon. See [Pagination](https://developers.stellar.org/docs/data/rpc/api-reference/pagination).",
"required": false,
"schema": {
"$ref": "#/components/schemas/TransactionsPagination"
"$ref": "#/components/schemas/Pagination"
}
}
}
3 changes: 2 additions & 1 deletion openrpc/src/stellar-rpc/examples/Events.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@
"txHash": "3f81b00a78830bb0186539cceed5ac137aad0d6872dd998c533c2758fbda0a6c"
}
],
"latestLedger": 1197964
"latestLedger": 1197964,
"cursor": "0005111084096696320-0000000001"
}
}
}
4 changes: 2 additions & 2 deletions openrpc/src/stellar-rpc/methods/getEvents.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"$ref": "#/components/contentDescriptors/EventFilters"
},
{
"$ref": "#/components/contentDescriptors/EventsPagination"
"$ref": "#/components/contentDescriptors/Pagination"
},
{
"$ref": "#/components/contentDescriptors/Format"
Expand All @@ -39,7 +39,7 @@
},
"cursor": {
"type": "string",
"$ref": "#/components/schemas/GetEventsCursor"
"$ref": "#/components/schemas/Cursor"
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions openrpc/src/stellar-rpc/methods/getLedgers.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"$ref": "#/components/contentDescriptors/StartLedger"
},
{
"$ref": "#/components/contentDescriptors/TransactionsPagination"
"$ref": "#/components/contentDescriptors/Pagination"
}
],
"result": {
Expand All @@ -36,8 +36,11 @@
},
"oldestLedgerCloseTime": {
"$ref": "#/components/schemas/OldestLedgerCloseTime"
},
"cursor": {
"type": "string",
"$ref": "#/components/schemas/Cursor"
}
}
}
},
"examples": [
Expand Down
6 changes: 5 additions & 1 deletion openrpc/src/stellar-rpc/methods/getTransactions.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"$ref": "#/components/contentDescriptors/StartLedger"
},
{
"$ref": "#/components/contentDescriptors/TransactionsPagination"
"$ref": "#/components/contentDescriptors/Pagination"
}
],
"result": {
Expand All @@ -36,6 +36,10 @@
},
"oldestLedgerCloseTimestamp": {
"$ref": "#/components/schemas/OldestLedgerCloseTime"
},
"cursor": {
"type": "string",
"$ref": "#/components/schemas/Cursor"
}
}
}
Expand Down
7 changes: 1 addition & 6 deletions openrpc/src/stellar-rpc/schemas/Cursor.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
"Cursor": {
"title": "cursor",
"type": "string",
"description": "A unique identifier (specifically, a [TOID](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0035.md#specification)) that points to a specific location in a collection of responses and is pulled from the `paging_token` value of a record. When a cursor is provided, RPC will _not_ include the element whose ID matches the cursor in the response: only elements which appear _after_ the cursor will be included."
},
"GetEventsCursor": {
"title": "cursor",
"type": "string",
"description": "The last populated event ID if total events reach the limit or end of the search window."
"description": "An opaque string which acts as a paging token. For endpoints which support pagination, the response will include a `cursor` field which can be included in a subsequent request to return the next page of results."
}
}
15 changes: 1 addition & 14 deletions openrpc/src/stellar-rpc/schemas/Pagination.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"EventsPagination": {
"Pagination": {
"type": "object",
"properties": {
"cursor": {
Expand All @@ -12,17 +12,4 @@
},
"required": []
},
"TransactionsPagination": {
"type": "object",
"properties": {
"cursor": {
"$ref": "#/components/schemas/Cursor"
},
"limit": {
"type": "number",
"description": "The maximum number of records returned by the endpoint."
}
},
"required": []
}
}

0 comments on commit eae3ac8

Please sign in to comment.