Skip to content

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

Open
@padurean

Description

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"`
}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions