Fork me on GitHub
#malli
<
2021-05-31
>
respatialized15:05:59

Apologies if I missed this while looking through the docs/source, but is there a way to make map schemas (and perhaps other schemas converted to the map syntax) self-documenting by adding something like:

(def my-map [:map [:k1 {:doc "A required key, typically used by the program to do foo."} :string] [:k2 {:optional true :doc "An optional key, typically used by the program for annotation purposes."} :string]])

respatialized16:05:57

It looks like malli.util/to-map-syntax and malli.util/from-map-syntax work just fine on the example I just gave, but I suppose I'm still wondering if the :doc kw in the props map is intended for a different purpose or potentially reserved in some way.

ikitommi16:05:00

@afoltzm using qualified keys is the safest, plain keys could be used for something special, but not going to add anything special for :doc. So, safe in practice. :description is picked up JSON Schema transformer, so that works too and is reserved for docs.

3