Releases: muonsoft/validation
Releases · muonsoft/validation
v0.17.0
What's Changed
- docs updated by @strider2038 in #77
- ULID validation by @strider2038 in #78
- UUID validation by @strider2038 in #79
- divisible by validation by @strider2038 in #80
- feature: at property by @strider2038 in #81
- bump golang x text dependency by @strider2038 in #82
Full Changelog: v0.16.0...v0.17.0
v0.16.0
- BC break stored constraints removed
- BC break ip testing function signature updated to return error instead of bool
Instance()
function invalidator
package
Full Changelog: v0.15.0...v0.16.0
v0.15.0
validation.ValidatableFunc
added as a functional adapter forvalidation.Validatable
interfacevalidation.BuiltinViolationFactory
is now exported and can be reused- few code examples added for some complex cases
v0.14.0
- Feature:
it.DateTimeConstraint
to validate date time values - Feature: marshal complex property path values into string
- Feature: property path unmarshaling from string
- Feature: new methods for
validation.PropertyPath
:- method
Elements()
returns property path as slice ofPropertyPathElement
- method
Len()
returns length of the property path
- method
- Feature: additional checks for
it.URLConstraint
:WithHosts
to check list of allowed hostsWithHostMatches
to check host by regexp patternWithRestriction
to check by closure
- breaking changes in packages
is
andvalidate
:validate.URL(value string, schemas ...string) error
signature replaced byvalidate.URL(value string, restrictions ...URLRestriction) error
is.URL(value string, schemas ...string) error
signature replaced byis.URL(value string, restrictions ...URLRestriction) error
v0.13.2
fix: revert behaviour for it.ChoiceConstraint
(method WithAllowedBlank
replaced by WithoutBlank
)
v0.13.1
- violations formatting updated
- more detailed assertion errors for violation assertions
v0.13.0
- big refactoring with breaking changes
- validation codes replaced by static errors
validation.Error
added with constructorvalidation.NewError()
Violation.Code() string
replaced byViolation.Unwrap() error
method- package
code
removed - all
Violation
implementations can now be tested by standarderrors.Is()
function for containing static errors
- most of constraint method names now are suffixed with
With
it.IsEqualToString
,it.IsNotEqualToString
,it.IsEqualToNumber
,it.IsNotEqualToNumber
removedvalidation.ViolationList.Each()
renamed tovalidation.ViolationList.ForEach()
validation.ViolationList.Has()
replaced byvalidation.ViolationList.Is()
- signatures for all constraints updated from
Validate<Type>(value, scope)
toValidate<Type>(ctx, validator, value)
validation.Scope
removed (all exported methods moved tovalidation.Validator
)validation.NewTypedArgument()
renamed tovalidation.This()
validation.CustomStringConstraint
renamed tovalidation.StringFuncConstraint
validation.NewCustomStringConstraint()
renamed tovalidation.OfStringBy()
validation.Language
argument removedvalidation.Option
and all implementations removed- argument
With
withOption
method replaced byAt
method with property path validation.PropertyNameElement
renamed tovalidation.PropertyName
validation.ArrayIndexElement
renamed tovalidation.ArrayIndex
it.NotBlankConstraint.AllowNil()
renamed toit.NotBlankConstraint.WithAllowedNil()
it.ChoiceConstraint
blank value behaviour updated (additional methodWithAllowedBlank()
added)- all previous deprecations removed
See all updates in pull request #74
v0.12.0
- Feature: Generic
Constraint
interface andNewTypedArgument
constructor. - Feature:
AllArgument
for composing a complex validation. - Feature:
AsyncArgument
for asynchronous validation. - Fixed: All error methods now have pointer receivers.
v0.11.0
ViolationListBuilder
added to build violation lists. Can be initiated byscope.BuildViolationList()
orvalidation.BuildViolationList()
methods.- New methods for
ViolationBuilder
and renaming (some methods are deprecated). scope.CreateViolation()
andvalidator.CreateViolation()
methods added.scope.Validate()
method is now exported.
v0.10.0
it.NotBlankConstraint
,it.BlankConstraint
,it.NilConstraint
andit.NotNilConstraint
now are based on generic comparable type and can be used asNumberConstraint
andComparableConstraint
:it.NotBlankNumberConstraint
andit.BlankNumberConstraint
are removed;it.IsNotBlankNumber()
andit.IsBlankNumber()
now returnsit.NotBlankConstraint
andit.BlankConstraint
;- new constructors were added.
it.ChoiceConstraint
now is compatible withNumberConstraint
andStringConstraint
.- New generic
it.ComparisonConstraint
added to compare comparable types. Use it with constructorsit.IsEqualTo()
andit.IsNotEqualTo()
. it.IsEqualToString()
,it.IsNotEqualToString()
,it.IsEqualToNumber()
andit.IsNotEqualToNumber()
marked as deprecated.- More runnable examples and docs.