Go Struct and Field validation, including Cross Field and Cross Field Cross Struct validation
Hey @awalterschulze thanks, I'll take a more in depth look, but at first glance I agree that the speed comparison is questionable
validator does a lot more than just validate, including returning detailed information on what, if anything, failed https://github.com/go-playground/validator/blob/v9/errors.go#L83 for translation, cross field validation etc...
and when you mention Disclaimer: I did take some shortcuts on BenchmarkStructComplexSuccess and BenchmarkStructComplexFailure by not including the last two fields.
the last two are the ones that require runtime reflection.
but I am intrigued and am always looking to improve :)
@all Guys u have this below struct
type PropertyMessage struct {
id string `form:"id" json:"id" binding:"required"`
data []map[string]interface{} `form:"data" json:"data" binding:"required" validate:"gt=0"`
}
Seems like gt
is not working when my POST request payload is
{
id: "abc",
data: []
}