Skip to content

Key name empty in field validation response #425

@vishal3152

Description

@vishal3152

Package version v9:

Question

The validation error does not show the key name i.e. myEmail.
How can I populate key name also for field validation?

Code sample, to showcase or reproduce:

func validateVariable() {

	myEmail := "joeybloggs.gmail.com"

	errs := validate.Var(myEmail, "required,email")

	if errs != nil {
		fmt.Println(errs) // output: Key: "" Error:Field validation for "" failed on the "email" tag
		return
	}

	// email ok, move on
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions