Fork me on GitHub
#malli
<
2020-12-21
>
ikitommi14:12:32

@raymcdermott listened that defn, good stuff. Finnish is simple, just pronounce the way you write it, right? 😉

3
😄 3
ikitommi14:12:28

but, reitit is pronounced ray-tit.

😂 3
dominicm17:12:41

Can confirm, Ray is a tit ;) @raymcdermott

ikitommi14:12:20

@rutledgepaulv the entry handling is bit too hard atm, but not sure what woud be a simpler way.

ikitommi14:12:42

there is a way to ask for the entry instead of the value, just a sec.

ikitommi15:12:52

oh, undocumeted, untested and had a bug, but maybe something like this?

(mu/find
  [:map [:b {:optional true} int?]]
  :b)
; => [:b {:optional true} int?]

(-> [:map [:a [:map [:b {:optional true} int?]]]]
    (mu/get :a)
    (mu/find :b))
; => [:b {:optional true} int?]

👍 3
ikitommi15:12:11

where mu/find is just sugar on top of the hidden feature of “give me the entry tuple” of:

(-> [:map [:a [:map [:b {:optional true} int?]]]]
    (mu/get-in [:a [::m/find :b]]))
; => [:b {:optional true} int?]

ikitommi16:12:53

btw, those interested in the sequence schemas, here’s the PR (draft): https://github.com/metosin/malli/pull/317

ikitommi16:12:49

(m/explain
  [:+ [:cat*
       [:prop string?]
       [:val [:alt* [:s string?] [:b boolean?]]]]]
  ["-server" :foo "-verbose" true "-user" "joe"])
=>
{:schema [:+ [:cat* [:prop string?] [:val [:alt* [:s string?] [:b boolean?]]]]],
 :value ["-server" :foo "-verbose" true "-user" "joe"],
 :errors (#Error{:path [0 :val :s], :in [1], :schema string?, :value :foo}
          #Error{:path [0 :val :b], :in [1], :schema boolean?, :value :foo})}

🔥 3