This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-13
Channels
- # aleph (15)
- # announcements (4)
- # babashka (36)
- # babashka-sci-dev (1)
- # beginners (15)
- # biff (2)
- # calva (15)
- # cider (3)
- # clj-kondo (8)
- # clojure (149)
- # clojure-europe (14)
- # clojure-norway (13)
- # clojure-switzerland (1)
- # clojure-uk (1)
- # clojurescript (21)
- # community-development (5)
- # cursive (20)
- # data-science (2)
- # datomic (7)
- # duct (5)
- # emacs (19)
- # etaoin (3)
- # events (2)
- # fulcro (11)
- # introduce-yourself (2)
- # jobs (4)
- # jobs-discuss (19)
- # joyride (1)
- # leiningen (11)
- # malli (7)
- # membrane (131)
- # nbb (12)
- # nginx (1)
- # off-topic (33)
- # pathom (8)
- # polylith (28)
- # re-frame (8)
- # sci (7)
- # shadow-cljs (225)
- # spacemacs (10)
- # specter (1)
- # vim (10)
- # xtdb (8)
I have a registry with large data objects specs. I created a list of base specs to have a more consistent taxonomy ex: :pk-int [int? {:min 1 :unique true}]
. What is the best way to represent these base specs? Should I have a separate registry or keep them in the same registry?
Newbie question: How do I specify that a value should be of a specific class, for example java.time.ZonedDateTime
[:fn #(instance? % java.time.ZonedDateTime)]
Not sure if there's another "official" way but I've done it that way in the past
Thanks! I thought there might be a more official way but this will do just fine.
It might be handy to create a new schema type for such Java classes. Here's an example by Tommi for Long
:
(def a-long (m/-simple-schema {:pred #(instance? Long %)}))
(m/validate a-long (Integer. 12)) ;=> false
(m/validate a-long (Long. 12)) ; => true
Hey, more of a implementation question: why schemas instances are implemented with reify instead of using records? When I tried extending IPrintWithWriter
to malli.core.Schema
it didn't work because the type generated for schemas with reify isn't malli.core.Schemas