metosin / malli

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

Metadata-defined function schemas do not get reinstrumented by malli.dev #861

Open roterski opened 1 year ago

roterski commented 1 year ago

Hello :wave:

I have noticed that functions schemas defined with metadata do not get reinstrumented by malli.dev on namespace reload. Any change to the file and namespace reload causes instrumentation to stop working.

This issue does not happen when a function is instrumented with malli.core/=>.

See the video showing this happening on the newest [metosin/malli "0.10.2"]:

https://user-images.githubusercontent.com/4920654/222991613-2e22a9ef-faf9-4e94-91d6-0c7aed07a572.mov

I'm not sure if it's just a bug or a known limitation but it takes away the dev utility of metadata schemas.

Let me know if I could help you with fixing it and big thank you for the library and those dev instrumentation features!

gpind commented 1 year ago

I can't comment on the intended behavior, but FWIW I've adopted the practice of calling (m.inst/collect!) at the end of any namespace that contains Malli function metadata. That ensures function schemas are always collected, without affecting prod. (Coincidentally, this was broken recently-ish and fixed in 0.10.2.)