-
Notifications
You must be signed in to change notification settings - Fork 212
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
Help: How to validate a dict with at least one of a set of keys? #258
Comments
I want to do something similar. I would like to validate that I have at least one entry:
Therefore, I want a Schema that renders |
I'm facing the same issue. Anyone able to solve this? |
Ok, here is what you can try to use:
|
This is helpful but doesn't solve the problem. Apart from E.g I want to validate {"name": "haris", "foo": "foo value"} such that |
How about this one:
|
I have a not so ideal validator like:
in which,
a
andb
must exist, whilec
ord
may or may not exist. It will be fine if neitherc
nord
shows up. And please also note thatc
andd
's value are of different type.How can I validate a dict that
a
andb
must exist, while at least one ofc
andd
should exist? I thought of replacing the twoOption()
s toRegex("c|d")
, but was not able to specify the data type according its key value.Any advice is appreciated.
The text was updated successfully, but these errors were encountered: