govalidator icon indicating copy to clipboard operation
govalidator copied to clipboard

Error should be thrown if a struct tag is not found

Open ghost opened this issue 8 years ago • 2 comments

After some debugging I discovered a misspelling of a Govalidator struct tag in my code, i.e.

type Person struct {
    Name string `valid:"aalpha"`
}

bob := Person{
    Name: "1nv4lid",
}

Running ValidateStruct on this struct reports no errors, although the tag aalpha does not map to a validator function.

I believe Govalidator should report an error in this case as per the principle of least surprise; it should be obvious to the Govalidator package that the tag name is incorrect if it's not found.

ghost avatar Jun 22 '16 04:06 ghost

Looks like this was fixed by 755af07baba135f1ec2678ad646ecb1d93a1096d

@asaskevich issue can be closed 😉

rjackson avatar Dec 17 '17 22:12 rjackson

Hello guys! I forked this package cause owner disappeared. Hope, he will be back, but it would be easier to merge these changes back if he is back Link to my repo: create issue there and we'll discuss it.

sergeyglazyrindev avatar Oct 17 '21 21:10 sergeyglazyrindev