This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-06
Channels
- # aleph (43)
- # announcements (11)
- # babashka (35)
- # beginners (70)
- # calva (4)
- # cider (8)
- # clerk (15)
- # clojure (192)
- # clojure-dev (7)
- # clojure-europe (44)
- # clojure-nl (2)
- # clojure-norway (65)
- # clojure-uk (4)
- # code-reviews (4)
- # conjure (1)
- # cursive (41)
- # data-science (1)
- # datomic (8)
- # emacs (7)
- # fulcro (13)
- # humbleui (17)
- # hyperfiddle (53)
- # kaocha (4)
- # malli (7)
- # missionary (17)
- # music (1)
- # obb (1)
- # off-topic (8)
- # polylith (1)
- # portal (3)
- # releases (11)
- # shadow-cljs (36)
- # squint (4)
- # tools-deps (4)
Hello, I'm trying to use a :fn schema that uses a function that is locally defined in the same file.
(*def* file-test2 [:fn '(*fn* [s] (test-fn s))])
When I try to validate using this schema an sci exception is thrown Could not resolve symbol: test-fn
I've tested test-fn in the REPL and it works as I expect it to. How to get Malli to recognize the symbol? Thank you
Thank you
I have a very basic question. Say I have a set user-roles
used in my code. In malli this would be e.g. (def UserRoles (into [:enum] user-roles))
. If I want to avoid duplication, do I handle this as described or do I go the other way around: use the malli schema as the source of truth then either use m/validate
(don't think it can replace a set for every use case) or (def user-roles (set (rest UserRoles)))
? It's just data, so both work, but wondering how you approach this.
I've applied them into the schema.
(def user-roles [1 2 3])
(def schema-1
[:role (into [:enum] user-roles)])
also allows variations...
(def schema-2
[:role (into [:enum] (conj user-roles 4))])
