Skip to content

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

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

Open
klingelschmidt opened this issue Jan 29, 2025 · 0 comments
Open

Comments

@klingelschmidt
Copy link

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.

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