Skip to content

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

@klingelschmidt

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.

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