This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-27
Channels
- # aleph (1)
- # announcements (5)
- # babashka (13)
- # beginners (68)
- # brompton (7)
- # calva (10)
- # cider (1)
- # clara (15)
- # cljsrn (2)
- # clojure (63)
- # clojure-austin (1)
- # clojure-europe (44)
- # clojure-france (2)
- # clojure-nl (5)
- # clojure-norway (1)
- # clojure-poland (1)
- # clojure-uk (8)
- # clojurescript (8)
- # clojureverse-ops (7)
- # conjure (13)
- # core-async (27)
- # cryogen (10)
- # cursive (17)
- # datomic (13)
- # deps-new (1)
- # events (1)
- # fulcro (3)
- # gratitude (4)
- # helix (6)
- # honeysql (6)
- # introduce-yourself (1)
- # jobs (2)
- # malli (13)
- # meander (9)
- # music (1)
- # news-and-articles (2)
- # off-topic (8)
- # pedestal (1)
- # reitit (4)
- # sci (25)
- # shadow-cljs (13)
- # spacemacs (2)
- # tools-build (5)
- # tools-deps (20)
- # vscode (50)
- # xtdb (2)
How would I express that a schema can only have key :a
OR key :b
but not both?
Would something like this work?:
[:and
[:map
[:x {:optional true} int?]
[:y {:optional true} int?]]
[:fn {:error/message "Only one of :x or :y allowed"} (fn [{:keys [x y]}] (not (and x y)))]]
there are ideas around declarative way of doing that in the future, either using datascript or meander syntax.
Hello! I'm trying to use an example from malli docs. Why I got an error?
(defn plus1 [x] (inc x))
(m/=> plus1 [:=> [:cat [:int {:max 5}]] [:int {:max 6}]])
;; Execution error (ExceptionInfo) at malli.core/-fail! (core.cljc:119). :malli.core/invalid-schema {:schema :=>}
hmm, I see a strange behaviour. If I run in terminal repl, everything woks fine. If I run via Idea+Cursive then I see this error. Btw, I deleted .cpcache completely.
In Emacs I see the same error
@U055NJ5CC I've found the reason of that error. If I add `
:jvm-opts ["-Dmalli.registry/type=custom"]
to deps.end alias, then I see this behaviour. Is it normal?found solution for this: `
(mr/set-default-registry! (m/default-schemas))
malli version 0.6.1
I think the answer to this question is probably going to be "just use reitit
".
Anyway, compojure.api
has support for coercion and validation via Schema
and spec
. Are there examples on how to use malli
instead?