This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-27
Channels
- # announcements (10)
- # beginners (95)
- # biff (2)
- # calva (33)
- # cherry (1)
- # clj-kondo (16)
- # clojure (96)
- # clojure-australia (1)
- # clojure-china (1)
- # clojure-europe (42)
- # clojure-filipino (1)
- # clojure-france (2)
- # clojure-hk (1)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-nl (1)
- # clojure-norway (24)
- # clojure-sg (11)
- # clojure-taiwan (1)
- # clojure-uk (1)
- # clojurescript (21)
- # cursive (22)
- # data-science (3)
- # events (7)
- # fulcro (3)
- # graalvm (4)
- # gratitude (6)
- # helix (11)
- # honeysql (7)
- # hoplon (1)
- # introduce-yourself (1)
- # jobs (2)
- # jobs-discuss (16)
- # lsp (15)
- # malli (14)
- # nbb (73)
- # practicalli (3)
- # reagent (8)
- # reitit (5)
- # releases (1)
- # ring (5)
- # rum (3)
- # sci (17)
- # scittle (7)
- # shadow-cljs (22)
- # tools-deps (26)
- # xtdb (9)
does malli has something like spec's conform
operation?
my use case is:
my schema has an or
:a string?
:b int?
:ab [:or :a :b]
And I a function that given the :ab
schema + a value, it tells me if the value is :a
, :b
or :invalid
try m/parse
& m/unparse
. If you want named nodes, you can: [:orn [:s :string] [:b :boolean]]
same with regexs, adding a n
to the name, you can present the nodes in entry-style and get named results, e.g. :cat
-> :catn
, :alt
-> :altn
Folks, can I ask for a huge improvement on Malli? Show the errors on instrument, on
, etc, at the end of everything
Sometimes when I get an error, I can't find it anywhere - either it is greater than my terminal buffer or it gets lost in the middle of a "your state is this" and "your schema is this"
It's not just inconvenient - on React-Native, for example, sometimes the console is not redirected to the REPL (because metro and other issues) so I keep having to disable and re-enable instrumentation 😢
the reporter option can be passed in to instrument and to start, so pretty quick work to copy the pretty namespace to your project and mess around how you like
I... actually have no idea what you mean 😄
Do you have an example?
(malli.dev/start! {:report (fn [type data] (.error js/console "Instrument error: " (str type)))})
Thanks, I'll try 🙂
sure thing 🙂 https://github.com/metosin/malli/blob/537c5fb8f96c35fc9e0d41629faa88a1aa8b56c3/src/malli/dev/pretty.cljc#L82 I meant you can copy this namespace and change it up as you like
Ok, for
there is a work-around - I can capture the :errors
property and pretty-print them