Open jremmet opened 3 years ago
Usecase: a dict with keys where the name shows which kind of validator should be used to validate it. e.g.
{ "val_foo": 1 "val_bar": 2 "str_foo: "hello" "str_bar": "world" }
To validate this directly something like this would be nice:
Dict(extra=[ (Str(pattern="val_.*"), Int()), (Str(pattern = "str_.*), Str()) ])
I didn't find a way to avoid link the key and value validator. Splitting this up via OneOf fails if both kinds of keys are present.
Good point! However, I would like to implement more general solution.
Usecase: a dict with keys where the name shows which kind of validator should be used to validate it. e.g.
To validate this directly something like this would be nice:
I didn't find a way to avoid link the key and value validator. Splitting this up via OneOf fails if both kinds of keys are present.