matcher-combinators
matcher-combinators copied to clipboard
Improve :mismatch/detail for missing keys
;; 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]}}