This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-06
Channels
- # announcements (2)
- # architecture (2)
- # aws (18)
- # babashka (7)
- # beginners (149)
- # bristol-clojurians (4)
- # calva (11)
- # chlorine-clover (1)
- # cider (8)
- # clj-kondo (2)
- # cljdoc (2)
- # cljsrn (2)
- # clojure (186)
- # clojure-canada (3)
- # clojure-europe (3)
- # clojure-gamedev (5)
- # clojure-italy (1)
- # clojure-nl (13)
- # clojure-norway (4)
- # clojure-spec (25)
- # clojure-uk (32)
- # clojurescript (75)
- # core-async (2)
- # cursive (16)
- # data-science (3)
- # datomic (20)
- # docker (1)
- # emacs (26)
- # fulcro (7)
- # graphql (1)
- # incanter (1)
- # leiningen (1)
- # luminus (7)
- # malli (7)
- # mount (11)
- # off-topic (19)
- # pathom (15)
- # re-frame (9)
- # reagent (9)
- # remote-jobs (4)
- # ring-swagger (4)
- # shadow-cljs (63)
- # spacemacs (11)
- # sql (2)
- # vscode (7)
will malli eventually do, for lack of a better term, a keyset coerce/conform? I try to use open keysets as much as possible, but always struggle the best way to handle stuff like the following
(-> {:a .. b:.. :c .. :d} ; say input from api call
validate ; we only care about :a,:b and :c but ignore :d
do-something-with-a-and-b ; fine with a s/keys [:a :b] or m/validate equivalent precondition
do-something-with-c ; fine with a s/keys [:c]
(select-keys [:a ::c]) ; or (transform my-schema)
(write-a-b-c-to-datomic) ; at this point I want a closed schema/spec precond, that could potentially narrow the keys on the way in?
@eoliphant would something like (mu/select-keys map-of-abc [:a :b])
be good? you can always make maps closed, to either fail on extra keys or to strip extra keys in transform
hmm yeah, perhaps strip extra on transform is the way to go? again, just been thinking about this, in terms of a structural coercion, but that might not be the best approach