malli
malli copied to clipboard
Custom Default Options
what
Instead of allowing one to override just the default registry (using malli.registry/type), one should be able to override the full default options instead.
why
- one can configure anything, e.g. override error localization, generators, ...
scican be passed in via explicit option - there can be schema systems with and without sci in same JVM:
(m/schema
[:fn '(fn [x] (> x 10))]
{:evaluator malli.sci/evaluator})
how
instead of malli.registry/type, define a malli.core/options with values "default" or "custom". Relevant keys are (at least):
:registry(themalli.registry/Registryimpl:evaluator, maybe a Protocol for this too.
big change
nah, mostly mechanical port.
maybe:
(malli.core/set-default-options!
{:registry (malli.core/schemas)
:malli.sci/options ...
:malli.core/cache ...})
Let's close this for now to clean up the issue list. Feel free to reopen if the idea moves out of the hammock!