This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-10
Channels
- # announcements (3)
- # architecture (54)
- # babashka (11)
- # beginners (12)
- # calva (5)
- # clj-on-windows (1)
- # cljdoc (2)
- # cljs-dev (1)
- # cljsrn (6)
- # clojure (130)
- # clojure-europe (8)
- # clojurescript (21)
- # conjure (23)
- # core-async (4)
- # datomic (7)
- # depstar (77)
- # events (1)
- # fulcro (27)
- # lsp (88)
- # malli (5)
- # meander (1)
- # off-topic (4)
- # pathom (43)
- # polylith (39)
- # re-frame (9)
- # shadow-cljs (14)
- # timbre (3)
- # tools-deps (53)
Hi, I get my feet wet in malli for the first time. I watched a couple of videos, I read some articules and scrolled the malli readme, and I;m still a bit confused about transformers.
I'm trying to create a bigdec?
pred and transformator for it, so for given data structure I could coerce selected values from string
and number
to bigdec
.
I looked for some examples on the internet. There are some examples of using pre-defined transformers but no examples of custom transformers. I mean, I haven't checked the code of Malli, I guess, that is the ultimate source of info.
Questions I'm trying to answer now:
• what are the guidelines for writing transformers?
• how to define custom predictor (in similar fashion to string?
)?
• how to marry a custom predictor with a custom transformer (so when coercing a data structure, the transformer can detect properties to coerce for my custom predictor)
Any hints, links, would be very helpful. Thank you 🙇
good place to start could be this: https://github.com/metosin/malli#simple-schema
has a custom type, with a custom transformer, generator, json-schema mapping & humanized error dedinition
I used to use Clojure Spec before, but I have never used Plumatic Schema before. I know it might sound ridiculously silly, but I haven't matched in my couscous mind the word 'schema' with a data shape definition. I mean, it makes total sense now, just I so get used to the word 'spec'. I don't know how I was watching this videos and reading these posts without that basic vocabulary understanding 😅