I'm using GoLang Validator on a struct to validate its fields. Even though I don't add required tag, it still behaves as if it is required.
type Order struct {
// ... other fields
UserID string `json:"userId" validate:"uuid4"`
// ... other fields
}
if err = validator.New().Struct(i); err != nil {
return err
}
Output: User ID: unknown error
It is not required hence the value is zero-value but it still returns an error. Am I doing something wrong here?