You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Fixes Or Enhances
This Pull Requests adds a new tag called `isvalid`
If the field is marked with the validator tag `isvalid`, the type must
implement the interface `Validate() error` and the return must be nil to
be considered `valid`
A possible use case is: when dealing with Enumerations, the type can
support a method `Validate() error` to check if the value is in specific
the range defined. If we use
[enumer](https://github.com/dmarkham/enumer) it generates a `IsA<Type>()
bool` method that can be used to verify if the enumeration is valid or
not, instead force the `oneof` tag (that needs to be always updated when
we add one new value.
I wrote a pull request to add a Validate method on enumerations
[here](dmarkham/enumer#102) and the interface
`Validate() error` seems pretty common.
It may clash with existing tags that people may register, this is
something that I don't know how to solve.
**Make sure that you've checked the boxes below before you submit PR:**
- [X] Tests exist or have been written that cover this particular
change.
@go-playground/validator-maintainers
---------
Co-authored-by: nodivbyzero <[email protected]>
0 commit comments