This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-28
Channels
- # asami (1)
- # aws (9)
- # babashka (16)
- # beginners (32)
- # calva (2)
- # clj-kondo (20)
- # cljdoc (6)
- # clojure (35)
- # clojure-dev (25)
- # clojure-europe (11)
- # clojure-india (1)
- # clojure-norway (2)
- # clojure-spec (26)
- # clojure-uk (1)
- # clojurescript (41)
- # conjure (3)
- # css (9)
- # cursive (18)
- # data-oriented-programming (6)
- # data-science (2)
- # emacs (47)
- # events (1)
- # fulcro (15)
- # graalvm (30)
- # gratitude (7)
- # honeysql (27)
- # inf-clojure (4)
- # introduce-yourself (2)
- # lsp (129)
- # malli (7)
- # missionary (21)
- # nbb (17)
- # off-topic (18)
- # re-frame (6)
- # releases (1)
- # shadow-cljs (120)
- # vim (7)
- # xtdb (15)
hi all! i’m using reitit with malli for parameter coercion, and I have a schema with default values for some parameters, but those default values aren’t being added. has anyone else run into this?
my router looks like this:
(def router
(rr/router routes
{:data {:coercion reitit.coercion.malli/coercion
:middleware route-middleware}}))
I discovered the reason, it was because it had {:optional? true}
in the options
is it possible to say "this is either a set or the specific keyword :bypass
"?
realized my mistake immediately, lol. the answer is: [:or set? [:enum :bypass]]
What would be the best way of handling multiple possibilities of a map inside a schema, based on a top level keyword? Maybe I can explain myself better with some examples, let's say I have something like this:
{:something "test"
:type :a
:deep {:depends 3}}
and
{:something "test"
:type :b
:deep {:another [1 2]}}
So, based on :type
, I'm expecting different things in :deep
. This seems to be a good case for :multi
, given it allows using a function for dispatch. But the dispatch function would take the :deep
map, not the top level whole map.
I have a work-around for this, but it's quite ugly and I'm wondering if there's a better way.