I support this change wholeheartedly, more so that’s exactly what I had in mind.
I believe what @chenglou mentioned about combinations resonates well with ocaml’s practice of making illegal states unrepresentable.
That being said, I still think having built-in validators gives more value than it brings complexity. People will likely create their shortcuts, anyway. I can’t see myself copy pasting validators for every form I have, especially the basic, tedious, but absolutely necessary ones.
I realise that current explicit validators are self-explaining, but they make forms so painfully verbose. From the UX/DX standpoint, making people write functions for number range or string length and regexes for emails and dates is a big turn off.
What I see less needed, however, is the meta
field. I can’t think of any essential use case for it other than password strength.
As for Valid
message, I’d consider adding it to the form’s state instead (to possibly consume it from the response).