Tag Archives: Invalid validation tag on field ‘Username’

The back-end receives the field validation errors passed by the front-end: invalid validation tag on field ‘username’

background

Received username, string length greater than or equal to 2 bits, incorrect use

Username string ` validate:"required,min=2," `

The console prompts that the validation label on the error information field “username” is invalid

After finding the validate document, the correct import method is used. After using the string format restrictions such as min, the require is no longer used

	Username string ` validate:"min=0,max=5" `  //use requier instead of min