Closed noonien closed 7 years ago
This is expected. The In
rule checks if a value can be found in the list of prespecified values.
See the code doc below:
// Note that the value being checked and the possible range of values must be of the same type.
I see, how does one validate such a case though? Should In() not work with slice types?
You are trying to determine if a string slice is "in" another string slice. This is not well defined - should the former be fully included in the latter, or should it allow partial intersection?
You will need to have a custom rule to support this check. You may refer to the in.go
file for details. It's not very complicated.
Well, such a field would be valid if all elements in it are valid.
But I understand why creating a new rule makes more sense.
The following test:
Fails with: Field: must be a valid value.