Closed karenetheridge closed 4 years ago
I don't have the time to implement this, but I'm open to a PR.
Just note that it has to handle deep and nested cases in a readable way. The test case submitted is good enough to illustrate the problem, but not good enough to get accepted in a PR.
Do you mean that this is not a good test, or that there should be more tests than this? What sort of other things should be tested? are there existing tests that I can copy from that are similar?
I'm saying it need to look more like https://github.com/mojolicious/json-validator/blob/master/t/issue-103-one-of.t and not like https://github.com/mojolicious/json-validator/blob/master/t/jv-oneof.t to make sure that the code handles nested oneOf/allOf/... so it's not just pretty for the simple cases.
ok! I'll have a go at providing a fix (but probably not today).
I'm going to close this, since #184 will get merged.
When more than one 'oneOf' rule matches, the error is not correct. The following script demonstrates the issue:
In the
_validate_one_of
sub, I think we should be tracking all the rules that do match, and then if@matched
!= 1, the path to all the matching rules can be easily provided in the error message. As it is now, only the failing rules are tracked, and this is used to construct the error message, but that is not helpful here.