This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-30
Channels
- # adventofcode (3)
- # announcements (4)
- # babashka (42)
- # beginners (56)
- # biff (23)
- # cider (8)
- # clj-yaml (2)
- # cljdoc (16)
- # clojure (83)
- # clojure-europe (52)
- # clojure-nl (3)
- # clojure-norway (4)
- # clojure-sweden (2)
- # clojure-uk (2)
- # clojurebridge (1)
- # clojurescript (2)
- # cloverage (1)
- # cursive (11)
- # data-oriented-programming (1)
- # deps-new (2)
- # dev-tooling (2)
- # emacs (3)
- # etaoin (4)
- # events (5)
- # fulcro (5)
- # gratitude (3)
- # java (3)
- # jobs (1)
- # jobs-discuss (1)
- # joyride (33)
- # malli (16)
- # music (1)
- # nbb (1)
- # nrepl (4)
- # nyc (1)
- # off-topic (25)
- # pathom (8)
- # re-frame (1)
- # reitit (7)
- # remote-jobs (2)
- # shadow-cljs (6)
- # tools-deps (9)
I'm wondering, when invoking (mg/generate schema)
, if the schema contains something like [:enabled {:default true} :boolean]
, can the generate always use the default value, rather than flipping between true and false?
I think you could do [:enabled {:gen/elements [true]}]
Maybe I’m wrong, https://github.com/metosin/malli#value-generation
I'm a little confused as to where optional
sits in a schema. It's not immediately clear in the documentation. Is this [:map [:name {:optional true} :string]
same as [:map [:name [:string {:optional true}]]]
?
I don't think so. Pretty sure :optional
needs to be a parameter of the map key entry.
(The former)
i believe that the position of the {}
is supposed to look like metadata on the following object
so [:map [:name :string]]
and then with the optional "metadata"/params [:map [:name {:optional true} :string]]
I see, so, [:map [:name {:optional true}]]
means the name is optional. Then if I have [:map [:name {:optional true} [:string {:min 1 :max 4}]]]
, then it's not only optional, but I've also said that the string (if provided) must be between 1 and 4.
ah yeah, it would be the previous thing not the following, as you've noted with the {:min 1}
example
{:optional true}
means that the key might not be present, whereas [:maybe X]
means the value might not be present