Repository navigation
feat: paging yields what an API lists a page at a time - #7
Merged
Merged
Conversation
page.Pages yields each page of a list, fetched by cursor as the one before is used up, and page.Items the items of each: both stop when the loop breaks and at the first error, which they yield. They are what the iterators openapi-codegen will generate for a list rest on, so no library writes its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y
…ge does not collide with Generated code imports it into packages of APIs, which often declare a page of their own, as Notion's does: an import named page collides with any page declared at package level. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y
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.
A new package,
paging, which the iterators openapi-codegen will generate for paginated lists rest on. No library then writes its own.Both stop when the loop breaks, and at the first error, which they yield once. The cursor type is generic, so a UUID cursor stays a UUID and a named string stays its own type. A generated
ListCommentsPagesis one call topaging.Pages, andListCommentsAllone call topaging.Itemsover it.Why
pagingand notpage. Generated code imports it into an API's own package. Such packages often declare apageof their own, and an import namedpagecollides with any package-levelpage. codegen's golden build caught that.It's the same logic as notion's hand-written
all, which it will replace. The tests cover paging, breaking out at the first item and at the first page, and an error after some items, at 100% coverage. The README now namesunion,apitestandpaging.make readypasses.🤖 Generated with Claude Code
https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y