Closed karenetheridge closed 4 years ago
Would it be possible to let the user know which rules that failed?
Yes, that should be possible with a bit of juggling. I'll push an update.
Don’t do it if it’s a lot of hassle/lines of code.
It would be a few lines of code -- we can get all the failure rules numbers by doing
- push @expected, $schema_type;
+ push @expected, [$i, $schema_type];
and then @failed = sort {$a <=> $b} map $_->[0], @errors, @expected
, but then we need to subtract that list from 0..@rules-1
to get the rules that passed. I don't see how to do it without at least one extra local variable :)
I pushed another commit that uses the indexes of the matching oneOf rules, which you can squash if you like it, or ignore if you don't :)
I force-pushed a much nicer change for adding passing indexes. :)
and done!
fixes #164.