pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
andrewzhurov 2020-08-11T12:37:40.433700Z

> The `::pc/params` is currently a non-op In mutations, to ensure only the desired data is being transacted, is there a nice way to select a shape from params ? shape described with clojure.spec or EQL maybe

Björn Ebbinghaus 2020-08-11T16:32:54.435Z

I dont know if it will help, but I wrote a small spec plugin for params once: https://github.com/hhucn/decide/blob/4286fe83303598cc831add58319ee2d631981cac/src/main/decide/server_components/pathom.clj#L52

(def spec-plugin
  {::p/wrap-mutate
   (fn [mutate]
     (fn [env sym params]
       (if-let [spec (get-in env [::pc/indexes ::pc/index-mutations sym ::s/params])]
         (if (s/valid? spec params)
           (mutate env sym params)
           (do
             (log/warn (s/explain-str spec params))
             (throw (ex-info "Failed validation!" (s/explain-data spec params)))))
         (mutate env sym params))))})

👍 1