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

[Feature Request] Add SemverType.FREESTYLE #65

Open
johnny-the-coder opened this issue Mar 18, 2022 · 0 comments
Open

[Feature Request] Add SemverType.FREESTYLE #65

johnny-the-coder opened this issue Mar 18, 2022 · 0 comments

Comments

@johnny-the-coder
Copy link

I would like to use Semver library to sort versions that does not necessariy meet STRICT or LOOSE requirement.
Here my exemplary set of versions: "v1", "2", "1.1", "5.0.3.GA", "unknown", "anyString-that-cannotBeParsedAsVersion", etc.
Currently if I use any of existing SemverTypes it throws exception in constructor (e.g. for "unknown").

I would like to have new SemverType.FREESTYLE (the name can be changed if you find better one) so that it can parse versions like LOOSE (or event NPM) but those which could not be parsed (e.g. "unknown") would be also constructed and put in the end while sorting (compareTo() method).

So if i have a list of Semver 'versions' objects which values: "v1", "2", "1.1", "5.0.3.GA", "unknown"
The Collections.sort(versions) would give one of the following (please choose which would be easier/better to implement):

  • "1.1", "2". "5.0.3.GA", "unknown", "v1" (if "v1" would not be parsed as a valid version)
  • "v1", "1.1", "2". "5.0.3.GA", "unknown" (if "v1" would be parsed as a valid version)
  • "1.1", "2". "5.0.3.GA", "v1", "unknown" (if "v1" would be parsed as a valid version but ordered after pure numeric versions)
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

No branches or pull requests

1 participant