malli
malli copied to clipboard
How to get more verbose schema error output than `:malli.core/invalid-schema`?
I'm working on a large Clojure client project with hundreds of Malli schemas. When I try to run tests locally, I just get :malli.core/invalid-schema errors. I tried to instrument using (malli.instrument/instrument!) in the calling namespace, but this does not change error output. Perhaps it does not propagate down to imported namespaces?
I tried to do this:
(def default-schemas
(mr/custom-default-registry
(merge
(m/default-schemas)
{:my-schemas {}
::m/explain-errors true})))
But getting argument errors.
Is there a way to turn on global schema error reporting so I can figure out which schema is causing the invalid-schema error, please?
OK, so I managed to trace it down by turning on (malli.dev/start! {:report (pretty/reporter)}) until I found the issue. The cause seems to be that namespaces with Malli schema definitions are not being evaluated until I manually eval them, even though they are in :require. So this is not a Malli issue, but I have no idea how to fix it.
Feel free to close, but maybe someone knows why this is happening?
If you have require on the ns, it should load normally. (malli.dev/start!) is a good way to get detailed errors. Closing this.