adamreeve / semver.net

Semantic versioning for .NET
MIT License
117 stars 22 forks source link

Make PartialVersionclass consume-able externally #40

Closed arroyc closed 5 years ago

arroyc commented 5 years ago

There is a class PartialVersion already, how to consume it externaly? For example, following test that you have [InlineData("1", 1, null, null)] public void TestPartialVersion(string versionString, int major, int? minor, int? patch) { var version = new PartialVersion(versionString); Assert.Equal(version.Major, major); Assert.Equal(version.Minor, minor); Assert.Equal(version.Patch, patch);

I have similar situations, but can't consume due to protection level. I sent a PR #41

adamreeve commented 5 years ago

The PartialVersion class is an implementation detail for handling range specifications, it isn't intended to be consumed externally and I don't think it makes sense to make this part of the public API. If you really need this type of functionality I think you should be re-implementing it yourself.

svengeance commented 3 years ago

@adamreeve Following your advice I'm copying PartialVersion into my project. I think it's worth considering having a Version class that follows SemVer exactly, a Range class that follows the node ranges exactly, and then a PartialVersion class where the consumer of your library can not guarantee anything about the correctness of the input. You could even add conversion layers e.g. myPartialVersion.ToSemantic() where it fills in the gaps of what's missing (i.e. the input of "1" becomes "1.0.0").

Just a thought. The world is messy. Thanks for everything you've done here!