serby / schemata

Define, create, and validate your business objects based on specified schema.
45 stars 16 forks source link

Argument issues with validate() #15

Closed bengourley closed 10 years ago

bengourley commented 10 years ago

Some of the arguments to validate() are optional and so callback gets assigned to one of the other arguments if it's a function:

https://github.com/serby/schemata/blob/master/lib/schemata.js#L257-L262

When subschema arrays are recursively validated, the original arguments are passed in:

https://github.com/serby/schemata/blob/master/lib/schemata.js#L338

This results in the callback to validate() being called more than once.