-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Would you be interested in optional behavior that allows JSCK to provide more specific errors when anyOf or oneOf fails? I have a proof of concept patch that accomplishes this. The basic idea is to simply increment a counter when a test is executed. The schema with the highest count wins. In practice this means that the schema that was the closest match reports its errors.
The motivation for this is that I'm writing a module to produce user-readable errors from the error structure returned by JSCK and this is the only real thing in the way.
I have not figured out where I would put the option, as the constructor currently takes no arguments besides the schema, and it doesn't really belong in there. Perhaps a second optional argument could be passed that includes options, of which this is one? Maybe something like:
var validator = new JSCK(schema, { "anyOfClosestMatch": true });