v2.1.0
Loyalty on show field name
-
If there is JSON tag on struct the gody will get the field name from json tag value
-
Example where struct has a JSON tag
type Response struct {
FirstName string `validate:"not_empty" json:"fname"`
}
resp := Response{}
if validated, err := validator.Validate(resp); err != nil {
...
}
// output error: field fname cannot be empty
- Example where struct hasn't a JSON tag
type Response struct {
FirstName string `validate:"not_empty"`
}
resp := Response{}
if validated, err := validator.Validate(resp); err != nil {
...
}
// output error: field firstName cannot be empty
issue #13