Fork me on GitHub
#malli
<
2020-07-14
>
ikitommi08:07:33

@steveb8n doesn’t work :thinking_face:. Will check it out.

ikitommi08:07:05

(for some reason, the keys are not followed AFTER converted to keywords.

ikitommi08:07:41

oh, the key-transformer applies on :leave, which is after-the-fact.

ikitommi08:07:25

… should be on :enter on decode and on :leave on encode. Just a sec.

steveb8n08:07:49

no hurry. the workaround of doing 2 transforms is ok. but it will be good to see the transform composition handling this use case eventually

steveb8n08:07:02

even if that means dropping down to the interceptor level

steveb8n09:07:09

btw: for fun I might run https://github.com/stevebuik/Stu on my project. it’ll show the extra 200k from sci very clearly

steveb8n09:07:03

great! that was quick. I’ll update first thing tomorrow

steveb8n09:07:19

@lucio just added a feature to fork at about the same speed. you guys are awesome

🙂 3
ikitommi09:07:32

didn’t know about Stu, looks nice

steveb8n09:07:25

it needs a couple of fixes to use properly. let me know if you want to use it. then I’ll go fix them

👍 6
ikitommi09:07:52

@shortlyportly related to you question on #reitit, would this help:

(let [path->schema (atom {})]
  (mu/find-first
    [:and
     [:fn '(constantly true)]
     [:map
      [:name string?]
      [:tags [:set [:map [:name string?]]]]
      [:address [:and
                 [:fn '(constantly true)]
                 [:map [:street string?]]
                 [:fn '(constantly true)]]]]
     [:fn '(constantly true)]]
    (fn [s i _]
      (swap! path->schema update i (fnil identity s))
      nil))
  @path->schema)
;{[] [:and
;     [:fn (constantly true)]
;     [:map
;      [:name string?]
;      [:tags [:set [:map [:name string?]]]]
;      [:address [:and [:fn (constantly true)] [:map [:street string?]] [:fn (constantly true)]]]]
;     [:fn (constantly true)]],
; [:name] string?,
; [:tags] [:set [:map [:name string?]]],
; [:tags :malli.core/in] [:map [:name string?]],
; [:tags :malli.core/in :name] string?,
; [:address] [:and [:fn (constantly true)] [:map [:street string?]] [:fn (constantly true)]],
; [:address :street] string?}

ikitommi09:07:32

you would get the schemas per value path for standalone validation.

Dave Simmons16:07:34

Thanks again @ikitommi - I'll take a look. Just wanted to say love your talks and the libraries metosin are putting out. many thanks.

3