metosin / malli

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

Nested map destructuring in `mx/defn` wraps extra collection #1020

Closed frenchy64 closed 3 months ago

frenchy64 commented 3 months ago

The following blows up when instrumented:

(mx/defn foo [{{inner :inner} :outer}]
  inner)
(foo {:outer {:inner true}})

The problem is that the inner map schema is wrapped in an :altn, which turns the outer schema into a [:map [:outer [:altn ...]]]. This turns the inner map into a sequence spec.

There's a potential fix here: https://github.com/metosin/malli/pull/1019

But I'm unsure how this might interact with other features like auto-flattening: https://github.com/metosin/malli/issues/1005