Allow major and minor versions for bootVersion parameter - #1797
Conversation
See spring-iogh-1797 Signed-off-by: sijun-yang <yangsijun5528@gmail.com>
Resolve the abbreviated forms in VersionParser.resolveLatest, next to parse, and accept `4` and `4.0` as well. The latest general availability version wins, so milestones and snapshots are ignored. parse is left alone on purpose. Its `x` support was added in spring-iogh-328 for compatibility ranges in the metadata, where an unresolved wildcard becomes a 999 sentinel so that a range keeps covering a whole line. That is a reasonable bound, but a fabricated coordinate for a request, and since Version.parse has no latest versions to resolve against it was the only possible outcome there: bootVersion=2.3.x used to generate a project with parent 2.3.999. resolveLatest returns null instead, so the request is rejected with a 400. When a resolved version falls outside the platform compatibility range, /dependencies now names that version in the error rather than the abbreviated form that was requested. Version numbers are now capped at nine digits, turning an oversized bootVersion into a 400 rather than a NumberFormatException. See spring-iogh-1797
|
Thanks for the PR! I like the idea and the shape of it, so I've taken it with some polish on top. Here's what changed and why, so nothing is a surprise. Kept from your PRResolution of abbreviated What the polish changes
The latest general availability version wins. Milestones and snapshots are ignored, via a new To your note about Only trailing numbers can be
Version numbers are capped at nine digits. An oversized Docs. Behaviour, against a local instanceOffering
Deliberately unchangedA version that parses but is not offered by the service is still accepted if it falls inside the compatibility range — |
e8b7601 to
30f04b6
Compare
This PR adds support for resolving Spring Boot version wildcards for the
bootVersionrequest parameter.This allows values such as
4.x.xand4.0.xto resolve to the latest matching Spring Boot version.Changes
VersionParser.VersionCapabilityto parse metadata-backed versions against configured values.DefaultProjectRequestToDescriptionConverterandProjectMetadataControllerto resolvebootVersionthrough metadata-backed version parsing.Notes
VersionParser#parseLatestmatches qualifiers exactly because it is a generic version parser that also has to handle snapshots and other qualified versions.Spring Boot used versions such as
2.3.10.RELEASEbefore its versioning scheme change. Since current GA versions no longer useRELEASE, values such as4.x.xand4.0.xresolve as expected with the current metadata.Closes gh-1479