metosin / malli

High-performance data-driven data specification library for Clojure/Script.
Eclipse Public License 2.0
1.44k stars 204 forks source link

`:=` schema does not work with maps #921

Closed camsaul closed 11 months ago

camsaul commented 11 months ago

Note sure if this is intentional behavior, but if it is I couldn't find it documented anywhere. I would have assumed := just compares things with clojure.core/=

(malli.core/validate
 [:= {}]
 {})
;; => Execution error (ExceptionInfo) at malli.core/-exception (core.cljc:138).
;; => :malli.core/child-error

(malli.core/validate
 [:= {}]
 {1 2})
;; => Execution error (ExceptionInfo) at malli.core/-exception (core.cljc:138).
;; => :malli.core/child-error

(malli.core/validate
 [:= {1 2}]
 {1 2})
;; => Execution error (ExceptionInfo) at malli.core/-exception (core.cljc:138).
;; => :malli.core/child-error
camsaul commented 11 months ago

Nevermind, I realize this is because it's assuming the map is an options map rather than the value I'm trying to compare with =