In their simplest form, the code changes required affect just two lines of production code, which need to be changed from max_version to max_stable_version, and a couple unit tests that need to be adjusted accordingly.
Theoretically, someone might depend on prerelease versions being returned by cargo search, so maybe should be mentioned in the changelog.
Thoughts on this?
I might be able to contribute a PR.
There is a difference between the official registry API specification and what extensions registries, like crates.io, make. So this isn't just a two line change but Cargo adding more requirements to what a registry is expected to do. There are things to do, like considering the field to be optional, but I hope its clear this is more than just a two line change.
No breaking API change necessary, but should document this field being used.
Introduce (or wait for) a v2 of the registry API.
Might allow for more distinct naming, e.g. max_stable_version and max_prerelease_version.
Change API of crates.io by populating max_version with the latest stable version instead.
Since the search API only provides one version field, the stable version makes sense for most use-cases.
Would need to introduce a new field max_prerelease_version with the latest prerelease version.
Alternatively, crates.io already populates a field newest_version with what appear to be prerelease versions.
Make use of the registry index, like cargo add does.
Would need to download the index before searching.
Would not help outside consumers of the search API, as they'd need code to parse the index.