This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-28
Channels
- # announcements (1)
- # aws (1)
- # babashka (15)
- # beginners (19)
- # biff (4)
- # clojars (24)
- # clojure (22)
- # clojure-europe (17)
- # clojure-norway (3)
- # clojurescript (10)
- # emacs (5)
- # gratitude (1)
- # introduce-yourself (2)
- # jobs (1)
- # malli (3)
- # off-topic (2)
- # re-frame (1)
- # remote-jobs (3)
- # shadow-cljs (71)
- # vim (4)
What’s the best way use properties with malli.core/-simple-schema
?
Here’s an example:
(-> (m/-simple-schema {:type :=2
:pred #{2}
:properties {:here? 1}
:type-properties {:or-here? 2}})
m/properties)
=> nil
I would have expected the map from either :properties
or :type-properties
to be returned from malli.core/properties
Properties go on an instance, type properties go on a simple schema definition The constructor could be documented better, so unless you want to read the source, what are you trying to solve?
Like Ben said:
• :type-properties
are shared for all instances, and do not contribute to form
• :properties
are defined into the instance, e.g. [my-type {:kikka "kukka"}]
• there are no utilities for reading both (could be), currently the schema applications (like json-schema transformation) merges those when reading, see https://github.com/metosin/malli/blob/master/src/malli/json_schema.cljc#L172