malli

https://github.com/metosin/malli :malli:
ikitommi 2020-07-14T08:36:33.151500Z

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

ikitommi 2020-07-14T08:37:05.152100Z

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

ikitommi 2020-07-14T08:37:41.152700Z

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

ikitommi 2020-07-14T08:39:25.153500Z

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

steveb8n 2020-07-14T08:58:49.154300Z

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

steveb8n 2020-07-14T08:59:02.154700Z

even if that means dropping down to the interceptor level

steveb8n 2020-07-14T09:00:09.155400Z

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

steveb8n 2020-07-14T09:15:03.156200Z

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

steveb8n 2020-07-14T09:16:19.157100Z

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

🙂 1
ikitommi 2020-07-14T09:16:32.157400Z

didn’t know about Stu, looks nice

steveb8n 2020-07-14T09:17:25.158200Z

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

👍 2
ikitommi 2020-07-14T09:46:52.159200Z

@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?}

ikitommi 2020-07-14T09:47:32.159900Z

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

Dave Simmons 2020-07-14T16:27:34.161200Z

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

1