This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-31
Channels
- # announcements (20)
- # asami (14)
- # aws (6)
- # babashka (15)
- # beginners (83)
- # biff (6)
- # calva (93)
- # cider (3)
- # clj-kondo (21)
- # cljdoc (106)
- # cljs-dev (32)
- # clojure (165)
- # clojure-dev (78)
- # clojure-europe (54)
- # clojure-italy (9)
- # clojure-nl (9)
- # clojure-norway (24)
- # clojure-uk (4)
- # clojurescript (6)
- # community-development (2)
- # conjure (2)
- # core-typed (14)
- # datahike (4)
- # datomic (2)
- # emacs (40)
- # events (1)
- # fulcro (11)
- # graalvm-mobile (29)
- # graphql (8)
- # honeysql (19)
- # java (1)
- # jobs (1)
- # lsp (232)
- # malli (5)
- # membrane (112)
- # nextjournal (11)
- # off-topic (63)
- # portal (12)
- # re-frame (6)
- # reagent (3)
- # reitit (4)
- # rewrite-clj (2)
- # shadow-cljs (25)
- # tools-deps (6)
Is it possible to supply an arbitrary generator function to an :fn
schema (or any schema really)? I know this is trivial, but works for an example:
(malli.g/generate [:map [:a [:fn {:gen/function (fn [] 1)} #(int? %)]]])
malli
throws an exception with that example, so obviously not correct but was hoping there was something like that.
The reason I ask is that we have, for example, a customer
schema with first-name
, last-name
, etc. The schema for first-name
uses string?
to validate but would like to constrain the generated values to a handful of simple names rather than the universe of all possible strings.
Would definitely make the generated data a bit more readable and user friendly.