ozzo-validation icon indicating copy to clipboard operation
ozzo-validation copied to clipboard

showing '-' as field name in error for hidden fields

Open Siltaz opened this issue 4 years ago • 0 comments

I'm validating a User struct whose password field is not exposed to the client. This is my user struct

type User struct {
	Name      string              `json:"name" bson:"name"`
	Email     string              `json:"email" bson:"email"`
	Password  string              `json:"-" bson:"password"`
}

and when validation fails for Password field it returns error as:

{
  "-": "the length must be between 8 and 18"
}

Is there any way so that i can pass field name to it ?

Siltaz avatar Jan 11 '21 15:01 Siltaz