malli icon indicating copy to clipboard operation
malli copied to clipboard

Custom Default Options

Open ikitommi opened this issue 4 years ago • 0 comments

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

  1. one can configure anything, e.g. override error localization, generators, ...
  2. sci can 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 (the malli.registry/Registry impl
  • :evaluator, maybe a Protocol for this too.

big change

nah, mostly mechanical port.

ikitommi avatar Jul 23 '20 08:07 ikitommi