File tree 3 files changed +11
-4
lines changed
3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ Malli is in well matured [alpha](README.md#alpha).
19
19
* Fix ClojureScript [ arithmetic warning] ( https://github.com/metosin/malli/issues/1093 )
20
20
* Distribute ` :merge ` over ` :multi ` [ #1086 ] ( https://github.com/metosin/malli/pull/1086 ) , see [ documentation] ( README.md#distributive-schemas )
21
21
* allow ` m/-proxy-schema ` child to be a ` delay `
22
+ * Fix ` malli.dev.pretty ` throws when explaining errors in nested maps [ #1094 ] ( https://github.com/metosin/malli/issues/1096 )
22
23
23
24
## 0.16.3 (2024-08-05)
24
25
Original file line number Diff line number Diff line change 193
193
(reduce (fn [acc error] (cond-> acc (accept error) (-replace-in value (:in error) (wrap error) mask))) acc errors)))
194
194
195
195
(defn -masked [mask x y]
196
- (cond (map? x) (reduce-kv (fn [acc k v] (let [e (find y k)] (assoc acc k (if e (-masked mask v (val e)) mask)))) y x)
197
- (set? x) (cond-> y (not= (count x) (count y)) (conj mask))
198
- (sequential? x) (-fill y (count x) mask)
199
- :else y))
196
+ (let [nested (and (map? x) (or (map? y) (nil? y)))]
197
+ (cond nested (reduce-kv (fn [acc k v] (let [e (find y k)] (assoc acc k (if e (-masked mask v (val e)) mask)))) y x)
198
+ (set? x) (cond-> y (not= (count x) (count y)) (conj mask))
199
+ (sequential? x) (-fill y (count x) mask)
200
+ :else y)))
200
201
201
202
; ;
202
203
; ; spell checking (kudos to https://github.com/bhauman/spell-spec)
Original file line number Diff line number Diff line change 758
758
(for [error (:errors explain)]
759
759
(me/error-value (assoc explain :errors [error]) {::me/mask-valid-values '...}))))))
760
760
761
+ (testing " masked nested maps #1096"
762
+ (is (= {" foo" " foo" }
763
+ (-> (m/explain [:map-of :keyword [:map-of :keyword :any ]] {" foo" {:bar 1 }})
764
+ (me/error-value {::me/mask-valid-values '...})))))
765
+
761
766
(testing " custom painting of errors"
762
767
(is (= {:EXTRA {:value " KEY" , :type :malli.core/extra-key }
763
768
:tags #{{:value " ground" } {:value " coffee" }}
You can’t perform that action at this time.
0 commit comments