matcher-combinators icon indicating copy to clipboard operation
matcher-combinators copied to clipboard

Improve :mismatch/detail for missing keys

Open dchelimsky opened this issue 5 years ago • 0 comments

;; TODO - file issue in matcher-combinators to improve :mismatch/detail for missing keys

(match {:a 1} {:b 2})

;; produces
{:match/result :mismatch,
 :mismatch/detail {:b 2, :a {:expected 1}}}

The :expected 1 without actual there is meant to be interpreted to mean the key is not present, but that could be more explicit. Something like this, for example (though certainly not the only solution):

{:match/result :mismatch,
 :mismatch/detail {:value {:b 2}, :missing-keys [:a]}}

dchelimsky avatar Mar 21 '20 23:03 dchelimsky