Fork me on GitHub
#malli
<
2022-12-28
>
TC23:12:37

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

Ben Sless05:12:30

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?

👍 1
ikitommi10:12:11

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