This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-17
Channels
- # announcements (7)
- # architecture (12)
- # babashka (5)
- # bangalore-clj (4)
- # beginners (70)
- # biff (23)
- # calva (21)
- # clojure (130)
- # clojure-bay-area (3)
- # clojure-berlin (1)
- # clojure-brasil (1)
- # clojure-europe (55)
- # clojure-finland (4)
- # clojure-greece (5)
- # clojure-nl (3)
- # clojure-norway (10)
- # clojurescript (52)
- # code-reviews (4)
- # community-development (1)
- # data-science (7)
- # datahike (6)
- # datomic (1)
- # events (1)
- # figwheel-main (7)
- # fulcro (23)
- # helix (2)
- # honeysql (32)
- # malli (18)
- # membrane (6)
- # nbb (22)
- # nyc (1)
- # off-topic (26)
- # pathom (2)
- # polylith (34)
- # quil (13)
- # releases (1)
- # remote-jobs (4)
- # scittle (1)
- # shadow-cljs (52)
- # sql (24)
- # tools-deps (17)
- # vim (11)
- # web-security (15)
- # xtdb (6)
Is this a bug?
(m/validate :at.least/ten 8
{:registry (merge
(m/default-schemas)
{:at.least/ten [int? {:min 10}]})}) ;; => true, but 8 < 10
I would expect the props from the vector to be passed to the schema.
(m/properties
(m/schema :at.least/ten
{:registry (merge
(m/default-schemas)
{:at.least/ten [int? {:min 10}]})})) ;; => nil
int?
is just a predicate, does not support properties, :int
is a real schema. Try [:int {:min 10}]
instead.
@U055NJ5CC predicate schemas probably support some properties, just not these
aha, thanks 👍 this would imply that there is not a real schema equivalent of inst?
, right? how come?
(defn -int-schema [] (-simple-schema {:type :int, :pred int?, :property-pred (-min-max-pred nil)}))
and
int?
is (-simple-schema {:type 'int?, :pred int?})
We could register property-pred
for predicates where it makes sense
.... though I might prefer just removing property predicates completely
I second that, speaking as a relatively new user coming from spec I expected int?
and :int
to be equivalent
but to end I would just like to say you guys but out some amazing libraries. i've learned a ton from reading your code. thanks!
shouldn't this also work?
(m/properties
(m/schema :at.least/ten
{:registry (merge
(m/default-schemas)
{:at.least/ten [:int {:doc "this number needs to be at least ten"
:custom/attrib :tranmogrify
:min 10}]})}))
ie, I expect schema properties to be returned, but is nilaha, malli.core/deref