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

NuGet API v2 Find-PSResource -Prerelease does not return prerelease if there is any newer stable release(s) #1607

Open
3 tasks done
o-l-a-v opened this issue Mar 23, 2024 · 1 comment
Labels
Area-Find feature_request Issue-Discussion Place for discussion about issue/feature/etc
Milestone

Comments

@o-l-a-v
Copy link
Contributor

o-l-a-v commented Mar 23, 2024

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

PowerShell Gallery / NuGet API v2 Find-PSResource -Prerelease -Name 'Az.Accounts' returns a stable release rather than a prerelease.

I expect this cmdlet to return the newest prerelease version, even if there's newer stable release(s) available.

Observation

Doing Find-PSResource -Name 'Az.Accounts' -Prerelease -Debug tells us that PSResourceGet does a GET to:

Which indeed just returns the absolute newest version, whether it's a prerelease or not.

Workaround

Following URL in my testing returns the newest prerelease, and does not care if newer stable release(s) exsists.

This works if asking for one package Id at a time. Don't know if it's possible to achieve this if asking for multiple Ids in the same request.

Expected behavior

Return newest prerelease version

Actual behavior

Returns absolute latest version, whether it's a prerelease or not.

Error details

No response

Environment data

Not relevant.

Visuals

No response

@o-l-a-v
Copy link
Contributor Author

o-l-a-v commented Apr 1, 2024

IMO, -Prerelease is misleading. It does not neccessarly get a prerelase version, but means IsAbsoluteLatestVersion in the PS Gallery API (NuGet v2). In other words: Get the absolute newest version, even if it's prerelease.

Suggestions:

  1. Add a new switch -PrereleaseOnly which does $filter=IsPrerelease&$orderby=Version%20desc&$top=1.
  2. Add alias to -Prerelease: -IncludePrerelease and -AbsoluteLatestVersion.
    • Removing or changing behavior of -Prerelease would probably be too radical, even though it's not behaving as one would expect?

@SydneyhSmith SydneyhSmith added Issue-Discussion Place for discussion about issue/feature/etc feature_request Area-Find and removed Needs-Triage labels Apr 3, 2024
@SydneyhSmith SydneyhSmith added this to the vNext milestone Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Find feature_request Issue-Discussion Place for discussion about issue/feature/etc
Projects
None yet
Development

No branches or pull requests

2 participants