Skip to content

Commit 7a8319e

Browse files
authored
(sdks) Add step and has-next-page flags for offset pagination (#1847)
1 parent a38bcf7 commit 7a8319e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

fern/products/sdks/guides/configure-auto-pagination.mdx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,22 @@ To set up auto pagination for the Fern Definition:
152152
1. Specify the pagination scheme, `offset` or `cursor`
153153
1. Specify where your `results` are located, using dot-access notation.
154154

155+
<Tip title="Offset pagination options">
156+
Include `step` in most offset pagination configurations to ensure the offset increments by the page size. Use `has-next-page` when your API returns a boolean indicator for additional pages.
157+
</Tip>
158+
155159
<CodeBlocks>
156160

157-
```yaml Offset {6}
161+
```yaml Offset {6-8}
158162
service:
159163
endpoints:
160164
listWithOffsetPagination:
161165
pagination: # Add pagination field
162166
offset: $request.page # Specify offset pagination scheme
163167
results: $response.data # Specify result location
168+
step: $request.page_size # Recommended: ensures offset increments correctly
169+
has-next-page: $response.has_more # Optional: path to next page indicator
164170
```
165-
166171
```yaml Cursor {7}
167172
service:
168173
endpoints:
@@ -172,7 +177,6 @@ service:
172177
next_cursor: $response.page.next.starting_after
173178
results: $response.data # Specify result location
174179
```
175-
176180
</CodeBlocks>
177181
</Accordion>
178182
</AccordionGroup>

0 commit comments

Comments
 (0)