NuGet Search API should provide all versions of packages in results
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
Originally reported here: https://developercommunity.visualstudio.com/t/Pagination-of-NuGet-packages-on-GitLab-d/1603607
The NuGet SearchService is an implementation of the NuGet Server APIs: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/packages/nuget/search_service.rb
This API is supposed to return a paged set of results with each result containing all versions of a package.
https://docs.microsoft.com/en-us/nuget/api/search-query-service-resource#search-result
| versions | array of objects | yes | All of the versions of the package matching the prerelease parameter |
|---|
However, this service is hard coded to only include 10 versions: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/packages/nuget/search_service.rb#L11
This query should return one result with 11 package versions, but returns one result with 10 package versions:
Steps to reproduce
- Configure a GitLab-based NuGet feed in a NuGet.config
- Use Visual Studio Package Manager to search for a package
- Use the UI to look at the versions, only 10 are shown
Example Project
Sample NuGet.Config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="gitlab.com" value="https://gitlab.com/api/v4/projects/31821522/packages/nuget/index.json" />
</packageSources>
</configuration>
What is the current bug behavior?
Only 10 versions of a package are returned in the search results.
What is the expected correct behavior?
All package versions should be included in the search results.
