This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-24
Channels
- # adventofcode (2)
- # anglican (1)
- # announcements (4)
- # aws (2)
- # babashka (28)
- # beginners (18)
- # brompton (3)
- # calva (22)
- # clj-kondo (2)
- # cljdoc (29)
- # clojure (41)
- # clojure-europe (28)
- # clojure-gamedev (14)
- # clojure-nl (2)
- # clojure-spec (2)
- # clojure-sweden (1)
- # clojure-uk (6)
- # clojurescript (53)
- # css (3)
- # cursive (6)
- # duct (3)
- # emacs (5)
- # fulcro (29)
- # introduce-yourself (1)
- # liberator (5)
- # lsp (1)
- # malli (11)
- # meander (4)
- # nbb (11)
- # off-topic (17)
- # pathom (2)
- # polylith (8)
- # practicalli (1)
- # react (6)
- # reagent (11)
- # releases (2)
- # rewrite-clj (11)
- # shadow-cljs (59)
- # tools-deps (21)
- # vim (11)
Hi, do you know what is happening here?
bq2pg.config> (m/validator [:map [:export? boolean?] [:import? boolean?] [:gcs-name string?]])
#function[malli.core/-map-schema/reify/reify--9403/fn--9419]
But using > 3 elements fails…
bq2pg.config> (m/validator [:map [:export? boolean?] [:import? boolean?] [:gcs-name string?] [:extra string?]])
Execution error (NoClassDefFoundError) at malli.impl.util/f (util.cljc:54).
malli/impl/util$f__7020__7021$fn__7045
@zikajk This happens only when I use malli.clj-kondo +
(-> (mc/collect *ns*) (mc/linter-config))
(mc/emit!)
(md/start!)
after some time… I can not reproduce it well enough 😞I’m trying out the instrumentation, and I’m probably doing something wrong, but I just can’t see it right now. The simple cases with primitives from the docs works, but when I try to validate a more “normal” schema, I can’t get it to work. This is an example:
(def coord-schema
[:map
[:x :int]
[:y :int]])
(defn down
{:malli/schema [:=> [:cat coord-schema] [coord-schema]]}
[coord]
(update coord :y dec))
When I then do (dev/start!)
I get the error
Execution error (ExceptionInfo) at malli.core/-fail! (core.cljc:119).
:malli.core/invalid-schema {:schema [:map [:x :int] [:y :int]]}
What am I missing?Looks like I was missing [:schema …]. This works.
(defn down
"Some docstring"
{:malli/schema [:=> [:cat [:schema coord-schema]] [:schema coord-schema]]}
[coord]
(update coord :y dec))
@U48DE3SHM it should be:
(defn down
{:malli/schema [:=> [:cat coord-schema] coord-schema]}
[coord]
(update coord :y dec))
e.g. don’t wrap schema in empty vector, invalid malli syntax.Ah, so my initial problem was the vector on the output all along. I see. Thanks, @U055NJ5CC.
@zikajk, I don’t know, but my goal was to use the devevelopment instrumentation, using (dev/start!)
the error message was really bad btw: `
malli.core/invalid-schema {:schema [:map [:x :int] [:y :int]]}
could have been something like:
malli.core/invalid-schema {:type [:map [:x :int] [:y :int]]
:schema [[:map [:x :int] [:y :int]]]}
@U48DE3SHM I experienced two different errors during schema validation when using instrumentation. Restarting helped though…