Release v4.0.0 #170
Closed
System-Glitch
started this conversation in
Announcement
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Motivation: Supporting only the last two minor versions of the language follows Google's policy and allows for development of new modern features. It lets the framework be updated without it being considered a breaking change, and encourages to not use outdated versions of the language while newer ones contain security fixes.
before_now
andafter_now
.RuleSet
andRules
composition for re-usability of redundant validated objects.validation.RuleFunc
tofunc(*validation.Context) bool
.validation.Context
provides more information and a cleaner and more flexible API.context.Value
instead of directly modifying the input data.array[]
will validate all the elements of thearray
array.confirmed
validation rule. Usesame:path.to.field
instead.required
rules to not pass if the parent is not required and missing.required
rules now allows empty strings.*validation.Context
in validation message placeholders. Thevalidation.Placeholder
signatures becomesfunc(fieldName string, language string, ctx *validation.Context) string
.Extra
(map[string]interface{}
) to*validation.Context
. This allows placeholders to use additional information given by the validator function.validation.StructList
. This acts as a better alternative syntax for validation. The previous alternative syntax (*validation.Rules
) should not be used for validation rules definition anymore but still works.Motivation: Although the validation package has seen some major improvements in v3, it was still far from perfect and was really lacking some important capabilities, such as the validation of objects in arrays. The array validation syntax was confusing, hard to read, and incompatible with the new syntax that was needed for object validation in arrays. We now have a more readable syntax, offering better capabilities. Because of how differently the validator works internally, we also had the opportunity to rework the error messages output, which now offers an impressive degree of precision. Precision in error messages gives a real edge over competing validation libraries.
helper
package and split it into several focused packages.helper/filesystem
moved toutil/fsutil
helper/walk
moved toutil/walk
util/httputil
ParseMultiValuesHeader()
andHeaderValue
util/reflectutil
Only()
util/sliceutil
IndexOf()
,IndexOfStr()
,Contains()
,ContainsStr()
andEqual()
(previously namedSliceEqual()
)util/sqlutil
EscapeLike()
util/typeutil
Map
,ToFloat64()
,ToString()
Motivation: The
helper
packaged started to become more and more bloated with functions for things unrelated to each other. To make this part of the code more idiomatic and expressive, the decision to split the package in several parts and re-think the naming was taken.model:"hide"
because it was redundant withjson:"-"
.goyave.ProxyBaseURL()
andserver.proxy
configuration entries.helper/walk
package to navigate complex data structure of unknown type (map[string]interface{}
). This is used by the validator.dgrijalva/jwt-go
library to the maintained golang-jwt/jwt.lang.SetDefaultLine()
,lang.SetDefaultValidationRule()
andlang.SetDefaultFieldName()
.sub
instead ofuserid
by default.auth.FindColums
.auth.FindColumns
andhelper.Only
.database.Paginator
improvementsDB
field so it can be re-assigned with new clauses.UpdatePageInfo()
method so it can be called manually before the real query.Paginator
.DisallowNonValidatedFields
middleware as it would be too expensive and complex to properly implement it with the new validation system.name
parameter inrequest.Cookie()
. Thanks to @agbaraka for the contribution!This discussion was created from the release Release v4.0.0.
Beta Was this translation helpful? Give feedback.
All reactions