Closed frenchy64 closed 3 months ago
Related https://github.com/metosin/malli/issues/1020
Map destructuring shouldn't convert to an :altn because it turns into a sequence spec when nested:
:altn
(malli.generator/generate [:map [:outer [:altn [:map [:map [:inner :any]]]]]]) ;=> {:outer [{:inner nil}]} (m/validate [:map [:outer [:altn [:map [:map [:inner :any]]] [:seq [:* :any]]]]] {:outer {:inner "a"}}) ;=> false
:orn is better for the job here:
:orn
(m/validate [:map [:outer [:orn [:map [:map [:inner :any]]] [:seq [:* :any]]]]] {:outer {:inner "a"}}) ;=> true
makes sense!
+1
Good catch, thanks!!
Related https://github.com/metosin/malli/issues/1020
Map destructuring shouldn't convert to an
:altn
because it turns into a sequence spec when nested::orn
is better for the job here: