Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple validation but with "OR" logic - e.g. valid:"host|ip" #459

Open
padurean opened this issue Dec 17, 2021 · 0 comments
Open

Multiple validation but with "OR" logic - e.g. valid:"host|ip" #459

padurean opened this issue Dec 17, 2021 · 0 comments

Comments

@padurean
Copy link

padurean commented Dec 17, 2021

Feature Request

Is it possible to use multiple validators on a struct field with "OR" logic?
For example the following would mean that Address must be either a valid host name or a valid IP:

type Config struct {
  Address string `validate:"host|ip, required"`
}
amm266 added a commit to amm266/govalidator that referenced this issue Jan 23, 2022
add or clause in type validation
asaskevich#459
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant