fastmail / Ix

automatic generation of JMAP-style APIs
GNU General Public License v2.0
10 stars 5 forks source link

enum() now also returns valid_values => [...] to provide hints #91

Closed wolfsage closed 7 years ago

wolfsage commented 7 years ago

This just seems like good metadata to provide. Could be used to auto-build forms or other types of validations, etc...

wolfsage commented 7 years ago

Rik points out that this breaks scalar context;

my $validator = enum(...) will return the final hashref, not the validator.

We'd be better served by an actual type system.