-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speculative error reporting for anyOf / oneOf #98
Comments
It looks like the constructor is variadic (I'm not sure why I'd want this) but it will probably interfere with my proposed interface. Possibly another way of doing this would be a method on the object, preferably that returns the object itself so it can be done in-line
|
Very interested. Also in any other improvements you think would better the error reports. |
Allowing for multiple schema documents was the workaround for not having remote refs. Variadic was possibly a bad idea. |
Just popping in to note that jsonschema has a similar feature that can be enabled by passing the option https://github.com/tdegrunt/jsonschema#results The "simple" error message leverages the When |
TODO: write some tests for the |
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:
The text was updated successfully, but these errors were encountered: