Closed maeglindeveloper closed 4 years ago
This is because when you validate a value which implements Validatable
, the Validate()
method will be called automatically after passing the specified rules. See https://github.com/go-ozzo/ozzo-validation/blob/master/validation.go#L83
This will cause an infinite recursion.
To solve this issue, you should directly call In.Validate()
within MyEnum.Validate()
.
@qiangxue thanks ! it works definitively better now ;) !
Hello everyone,
I'm actually facing an issue regarding the In() validation helper. I'm using it to validate a golang enumeration. Here is my enumeration definition & the Validate() method I defined for that "type":
Then, I tried to execute the following tests:
The first part works, "Test" is not a valid value for an
MyEnum
but the second part of the test brings me to a stackoverflow error.Here is a golang run link to test the code https://play.golang.org/p/rqoVqChoPJ_u
Am I doing something totally wrong ? Thanks for your collaboration team :)