This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-20
Channels
- # adventofcode (7)
- # announcements (1)
- # aws (1)
- # babashka (127)
- # bangalore-clj (1)
- # beginners (54)
- # calva (8)
- # cider (12)
- # clj-http (2)
- # clj-kondo (8)
- # cljdoc (10)
- # cljs-dev (2)
- # clojure (48)
- # clojure-australia (14)
- # clojure-dev (6)
- # clojure-europe (105)
- # clojure-nl (6)
- # clojure-taiwan (1)
- # clojure-uk (62)
- # clojurebridge (1)
- # clojurescript (112)
- # code-reviews (4)
- # cursive (20)
- # data-science (1)
- # depstar (1)
- # events (8)
- # fulcro (6)
- # graalvm (11)
- # honeysql (2)
- # introduce-yourself (3)
- # jobs (1)
- # jobs-discuss (30)
- # malli (23)
- # nrepl (4)
- # off-topic (47)
- # pedestal (22)
- # polylith (10)
- # portal (3)
- # re-frame (16)
- # reitit (9)
- # releases (3)
- # rewrite-clj (1)
- # ring (1)
- # spacemacs (1)
- # tools-deps (12)
- # xtdb (7)
Hi! Is Malli a good candidate to use for server side form validation in replacement for lib like https://funcool.github.io/struct/latest/? Especially thanks to malli.error / humanize?
With some hand made regex validators (email, etc) like https://github.com/funcool/struct/blob/master/src/struct/core.cljc#L195 + locale support, I think so, right?
Perfect, thanks for the confirmation. I'll toy with Malli in a project and see how to organize this. 👍
is there an example demo project with form validation somewhere?
I like very much the Reitit's example folder, if my tests are successful after a code review, I may be able to contribute with an example PR with form validation on Malli's Github.
What do you think?
sure, examples welcome! I have a malli-form (reagent) demo draft, but nothing serious.
Perfect, let's do this!
Awesome, thanks @dharrigan!
hi, Anyone know if Malli has support that allows you to set a default value if the value doesn't pass the schema check?
looks like that just sets a default if the value is missing:
(m/parse
[:and {:default 42} int?]
"test");; => :malli.core/invalid
(m/decode [:and {:default 42} int?]
"test"
mt/default-value-transformer);; => "test"
I'll probably just use m/explain
and do something based on if there are errorsmight not be simple as any fix could change the conditional branch that should be used (with :or
and :multi
). But you should be able to use malli.util
functions to access the invalid paths and work from there.
possibly. Generally I just want to check a map is valid but keep any good values and log out any errors
hi! Deref of [:merge ...]
makes :registry
with nested schemas of one of merged schemas invisible (but it still works). is it a bug, or feature, or there is some workaround Im missing?
point is - registry disappears from any of serialisations after deref, although it contains all information about recursive fields, and i assume there is no other way of define recursive schemas.
of course, i still could use underefed schema, but it much complicated