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
Better error messages when oneOf/anyOf doesn't match #38
Comments
Are you using the latest version? Additional properties and required fields should be very informative, if you use the verbose mode. How do you think the error message for the above example should be? |
Doesn't really matter. Maybe the same way that it works for the required fields?
|
@skilledDeveloper would something like the following work: {
field: 'data.bar.id',
schema: 'data.bar#anyOf[1]',
message: 'is the wrong type'
} Then we could add a schema identifier to subschemas as well to solve stuff like #22 as well |
That would be great. |
any news? |
@mafintosh I think a schema property would be a nice addition. First I thought it would be nicer if we could fix it without adding extra properties, but we add extra properties already when in verbose mode - so I guess it's ok :) I don't know if there is a convention for naming these "anonymous" inline schemas, but I think your When using |
+1 |
Consider this example:
Based on the
schema
thecandidate
is valid. However, if I change theid
to a string value (e.g "456"), I will get this error:While the error message is not wrong, it can be more informative by saying which field has issue.
The same thing can apply for missing required fields or having additional properties when it's not allowed.
The text was updated successfully, but these errors were encountered: