Skip to content

Cross field validation #22

@typerandom

Description

@typerandom

We should have the ability to integrate other fields into our validation rules.

Suggestion

In the example below, LastName would only be required if FirstName was set.

type Foo struct {
    FirstName string `validate:"empty|max(20)"`
    LastName string `validate:"FirstName.empty|not_empty,max(20)"`
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions