malli

https://github.com/metosin/malli :malli:
respatialized 2021-05-31T15:55:59.070200Z

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]])

respatialized 2021-05-31T16:02:57.072Z

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.

ikitommi 2021-05-31T16:43:00.072100Z

@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.

1