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

Handle paginated registry metadata responses #8219

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

plemarquand
Copy link
Contributor

@plemarquand plemarquand commented Jan 14, 2025

Motivation:

In 4.1 List Package Releases it is stated that a server may respond with a Link header that contains a pointer to a subsequent page of results. SPM is not checking for the next link in the Link header and so if a registry returns paginated results, only the first page of versions is searched when resolving. This would result in a "version not found" error when in reality the version is present in a subsequent page of results.

Modifications:

Respect the next link in the Link header by loading the next page of results and building up a list of versions, continuing until there is no next link present in the Link header of the last result.

Result:

Registry servers that serve paginated results now have all their results read.

Issue: #8215

In [4.1 List Package
Releases](https://github.com/swiftlang/swift-package-manager/blob/main/Documentation/PackageRegistry/Registry.md#41-list-package-releases)
it is stated that a server may respond with a `Link` header that contains
a pointer to a subsequent page of results. SPM is not checking for this
link in the `Link` header and so if a registry returns paginated results
only the first page of versions is searched when resolving.

Respect the `next` link in the `Link` header by loading the next page of
results and building up a list of versions, continuing until there is no
`next` link present in the `Link` header of the last result.

Issue: swiftlang#8215
@plemarquand plemarquand force-pushed the paginated-repo-client-versions branch from 5266f86 to 022da0b Compare January 15, 2025 15:56
@plemarquand
Copy link
Contributor Author

@swift-ci test

@plemarquand
Copy link
Contributor Author

@swift-ci test windows

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.

1 participant