Closed kelvinqian00 closed 4 years ago
@kelvinqian00 Thanks for reporting this! Yes, this appears to be a bug in how Expound groups specs.
@kelvinqian00 Thanks for reporting this and for your help with the fix! The fix is in version 0.8.0, which I've just released.
I've been using Expound and overall it's a great library. However the grouping and numbering of spec errors seems to be haphazard, which is annoying when one is validating (for instance) a map with many
keys
predicates.Here, we have a example
keys
spec:Then if I want to validate the following map:
I ideally want the following output (the Relevant Specs section has been removed for clarity):
where Expound prints out each failing spec in its own separate error message. However, what Expound actually does is print out this:
which is not what I want. Not only do the
::foo
and::bar
specs have nothing to do with each other (they are not two paths on ans/or
or anything like that), but there are clearly 3, not 2, errors here.Right now I've been using a hacky solution where I separate the original spec error map into a list of multiple error maps and using the
expound
method on each of them. But this comes with its own problems (it messes up the Detected Error count and overall it's just an ugly hack), so if this gets addressed that would be awesome.