metosin / malli

High-performance data-driven data specification library for Clojure/Script.
Eclipse Public License 2.0
1.5k stars 211 forks source link

Example of composite registry that composes the default registry with a custom one #796

Closed vemv closed 1 year ago

vemv commented 1 year ago

https://github.com/metosin/malli/tree/2b0c108b7c5d8b33206a4040b00dada0b103ec2c#composite-registry could be completed with an example of how to compose Malli's default registry with a custom one.

(I don't immediately know how to do that)

Thanks - V

vemv commented 1 year ago

I got this working, by copying this bit into my codebase:

https://github.com/metosin/malli/blob/4b4fe875203317eba1057bdffba6d7d8c9e78469/src/malli/core.cljc#L2422-L2426

and grabbing the registry value (the registry let binding found in L2424).

This is not optimal because 1) I'm not using Malli's actual registry but a copy of it, and 2) I'm copying around code, which can drift out of sync later.

You might want to expose this registry value such that one can reuse it / compose it at will.

ikitommi commented 1 year ago

there it is! https://github.com/metosin/malli/blob/ab0e109a2e1fd67092a07eb088c0b2f7f2181340/README.md?plain=1#L2974-L2979