SemVerValidationResult.cs 984 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Collections.ObjectModel;
  2. namespace Artees.UnitySemVer
  3. {
  4. /// <summary>
  5. /// Information returned about a checked semantic version.
  6. /// <seealso cref="SemVer.Validate"/>
  7. /// </summary>
  8. public class SemVerValidationResult
  9. {
  10. /// <summary>
  11. /// Error messages. This collection is empty if the version is valid.
  12. /// </summary>
  13. public readonly ReadOnlyCollection<string> Errors;
  14. /// <summary>
  15. /// Automatically corrected semantic version.
  16. /// </summary>
  17. public readonly SemVer Corrected;
  18. /// <summary>
  19. /// Does the version meet the <a href="https://semver.org/">Semantic Versioning 2.0.0</a> specification?
  20. /// </summary>
  21. public bool IsValid => Errors.Count == 0;
  22. internal SemVerValidationResult(ReadOnlyCollection<string> errors, SemVer corrected)
  23. {
  24. Errors = errors;
  25. Corrected = corrected;
  26. }
  27. }
  28. }