in reply to Re: Type::Tiny and anyOf, oneOf
in thread Type::Tiny and anyOf, oneOf

Thanks Toby. It probably can't be accomplished with a type. With a JSON Schema you can say about an object (Dict) that it must contain one of a list of (named) keys each with their own type. You could require either a phone number or an email address, for example. So something like:

my $check = compile(Dict[ foo => Str, oneOf => [ baz => Int, qux => Str, ], ]);


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^3: Type::Tiny and anyOf, oneOf
by tobyink (Canon) on Feb 04, 2021 at 21:54 UTC