balderdashy/anchor — pull request #47 by clarkorz (2014-05-26 01:50:21+00:00)
Title: Nested Schema Validation

Currently, anchor works only for either type(nested type) or ruleset. But I really need nested schema check which combines type and ruleset (means, any type defined in nested type schema can be replace with a ruleset). This PR add Nested Schema Validation, and the code is based on a copy of `deepMatchType`, I only refactor the old `matchType.js` and changed `anchor.prototype.to()` slightly. So it should be backward compatible: this PR pass all old anchor tests , `sails#master` tests and `waterline#master` tests, without changes.

But to make nested schema validation works, `request.validate()` and `Model#validate()` have to change the way of using `anchor.prototype.to()`. The former is quite simple, I'll send a PR on `sails`. The later is too complex, that's why I ensure it backward compatible.