-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
The package types has some important definitions like the type ValidationError and the func IsValidEmail.
However, this package as been used as a bag to avoid add imports during the generation of the validator file.
After this issue completed, types no more be used as a proxy to stdlib.
For a slice of string, instead of generate this:
if !(types.SlicesContains(obj.TypesIn, "a") || types.SlicesContains(obj.TypesIn, "b") || types.SlicesContains(obj.TypesIn, "c")) {
errs = append(errs, types.NewValidationError("TypesIn elements must be one of 'a' 'b' 'c'"))
}
will be generated something like this:
import "slices"
if !(slices.SlicesContains(obj.TypesIn, "a") || slices.SlicesContains(obj.TypesIn, "b") || slices.SlicesContains(obj.TypesIn, "c")) {
errs = append(errs, types.NewValidationError("TypesIn elements must be one of 'a' 'b' 'c'"))
}