Skip to content

Make key required when a different key has specific value? #6

Description

@klingelschmidt

Is it possible to make an optional key required when a different key is set to a value?
I though it could maybe be like this:

"datasource":   jio.String().Valid("foo", "bar").Required(),

"id":           jio.Number().When("datasource", "bar", jio.Number().Integer().Required()),

But it did not seem to work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

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