Interesting: here the key point is composability.
I wrote a validation library in the same vein but using functions as representations of sets
https://github.com/gcanti/tcomb-validation
We've been rebuilding a major app in Node and searching for validation solutions that would support async.
Embarrassingly, very few Node validation libraries support async!
This makes it annoyingly complex to have multiple sets of validation on the server to ensure a new user is indeed a new user, that foreign keys match their constraints, etc. on top of the dumb type checks.
Very clean and simple implementation. I like the idea of returning true and not truthy. So anything that !== true should be considered false. Well done!
Interesting. I am a co-author on the Methanal <https://launchpad.net/methanal> library which is more-or-less this same combinator approach but tightly coupled to Nevow Athena.
I recently (as near as a week ago) started working on a modern JavaScript implementation of the same idea but without the tight coupling to a particular framework.
5 comments
[ 3.9 ms ] story [ 17.4 ms ] threadEmbarrassingly, very few Node validation libraries support async!
This makes it annoyingly complex to have multiple sets of validation on the server to ensure a new user is indeed a new user, that foreign keys match their constraints, etc. on top of the dumb type checks.
We ultimately found Schemator from the js-data project: > http://www.js-data.io/v1.5.8/docs/js-data-schema
We've been able to put all of our sync/async constraints into varying "schemas" that run on both the client and the server!
I recently (as near as a week ago) started working on a modern JavaScript implementation of the same idea but without the tight coupling to a particular framework.
Very strange coincidence. :)