Releases: nobl9/govy
v0.11.0
What's Changed
🚀 Features
- feat: Add EqualProperties rule (#54) @nieomylnieja
Added
rules.EqualProperties
rule which helps ensure selected properties are equal.
The equality check is performed via a configurable function.
Two builtin functions are provided out of the box:rules.CompareFunc
which operates oncomparable
types andrules.CompareDeepEqualFunc
which usesreflect.DeepEqual
and operates on any type.
🧰 Maintenance
v0.10.0
What's Changed
🚀 Features
- feat: Add alphanumeric rules (#52) @nieomylnieja
Added
rules.StringAlpha
,rules.StringAlphanumeric
,rules.StringAlphaUnicode
andrules.StringAlphanumericUnicode
which help ensure strings contain only letters and numbers (either ASCII or Unicode).
v0.9.1
What's Changed
⚠️ Breaking Changes
- fix: Predicate matching for govy.PropertyRules (#51) @nieomylnieja
govy.PropertyRules
will no longer fail ifRequired()
was specified when a validate value is its type's zero value AND none of theWhen()
conditions are matched.
🐞 Bug Fixes
- fix: Predicate matching for govy.PropertyRules (#51) @nieomylnieja
v0.9.0
What's Changed
🚀 Features
- feat: Add StringDateTime and StringTimeZone rules (#50) @nieomylnieja
Added
StringDateTime
rule which ensures a string is a valid date and time according to the rules defined by https://pkg.go.dev/time.
AddedStringTimeZone
rule which ensures a string is a valid IANA Time Zone database code.
🧰 Maintenance
- chore: Update dependency cspell to v8.16.0 (#49) @renovate
- chore: Add OpenSLO use case to README.md (#48) @nieomylnieja
v0.8.0
What's Changed
🚀 Features
- feat: Add AssertErrorContains (#47) @nieomylnieja
Added
govytest.AssertErrorContains
function which helps test govy rules by checking if a producedgovy.ValidatorError
contains specified error.
v0.7.0
What's Changed
⚠️ Breaking Changes
- feat: Add cascade mode setting to Validator (#43) @nieomylnieja
govy.CascadeMode
enum now starts from 1 (previously 0). - feat: Allow converting rules for pointers (#42) @nieomylnieja
govy.NewRuleSet
now only acceptsgovy.Rule
. Previously passing anything else into it would not work either.
🚀 Features
- feat: Add benchmark report (#41) @nieomylnieja
Benchmarks for govy can now be easily inspected and tracked over time.
- feat: Add cascade mode setting to Validator (#43) @nieomylnieja
Added
govy.Validator.Cascade
which allows controlling error handling ongovy.Validator
level and propagating the setting togovy.PropertyRules
. For more details on cascade mode read this. - feat: Allow converting rules for pointers (#42) @nieomylnieja
Added two functions:
govy.RuleToPointer
andgovy.RuleSetToPointer
which both convert respectivelygovy.Rule[T]
andgovy.RuleSet[T]
to work on pointers of the same type:govy.Rule[*T]
andgovy.RuleSet[*T]
.
govytest.ExpectedRuleError
no longer requiresPropertyName
to be provided, this allows testing properties which have no name.
🧰 Maintenance
4 changes
- chore: Update README.md (#46) @nieomylnieja
- chore: Split test workflows for pushes to main (#45) @nieomylnieja
- chore: Fix benchamrk action (#44) @nieomylnieja
- chore: Update dependency cspell to v8.15.7 (#39) @renovate
v0.6.0
What's Changed
🚀 Features
- feat: Add StringCrontab rule (#40) @nieomylnieja
Added
StringCrontab
rule which verifies if a string is a valid crontab schedule expression according to the rules defined by crontab. - feat: Add StringRegexp rule (#38) @nieomylnieja
Added
StringRegexp
validation rule which verifies if a string is a valid regular expression according to https://pkg.go.dev/regexp/syntax rules.
v0.5.0
What's Changed
🚀 Features
- feat: Add file system rules (#37) @nieomylnieja
Added 4 new rules:
StringFileSystemPath
,StringFilePath
,StringDirPath
andStringMatchFileSystemPath
, which help verify file system paths and patterns. - feat: Add StringGitRef rule (#35) @nieomylnieja
Added
StringGitRef
validation rule which checks if a string is a valid git reference according to the rules defined by git-check-ref-format. - feat: Add benchmarks (#32) @nieomylnieja
Added benchmarks to builtin rules.
- feat: Support validating slices of objects (#30) @nieomylnieja
Added new validator function for slices:
govy.Validator.ValidateSlice
. It can be used to validate a slice of values, where each value has the same type as the validator's type constraint. Internally it callsgovy.Validator.Validate
on each element and returnsgovy.ValidatorErrors
.
🧰 Maintenance
v0.4.0
What's Changed
⚠️ Breaking Changes
- chore: Simplify StringDNSLabel rule (#29) @nieomylnieja
StringDNSLabel
is no longer aRuleSet
, instead it's now a singleRule
.
🚀 Features
- feat: Add WithNameFunc to Validator (#28) @nieomylnieja
Added
Validator.WithNameFunc
function which can be used to dynamically set the validator's name per-instance.
🧰 Maintenance
- chore: Simplify StringDNSLabel rule (#29) @nieomylnieja
- chore: Update README.md (#27) @nieomylnieja
- chore: Update kskitek/coverdiff action to v0.6.0 (#26) @renovate
v0.3.0
What's Changed
🚀 Features
- feat: Add test utilities (#25) @nieomylnieja
Added
govytest
package which exposes utilities which help test govy validation rules.
It comes with two functionsAssertNoError
, which ensures no error was produced, andAssertError
which checks that the expected errors are equal to the actualgovy.ValidatorError
.
AddedOneOfProperties
rule which checks if at least one of the properties is set.
🧰 Maintenance
- chore: Update dependency markdownlint-cli to v0.42.0 (#24) @renovate
- chore: Create coverage-pr-report.yml (#23) @nieomylnieja