Fork me on GitHub
#malli
<
2020-01-06
>
ikitommi11:01:32

yeah, the default-value-transformer uses schema properties and mounts for all schemas.

ikitommi18:01:35

Breaking transformer api, hopefully making it better: https://github.com/metosin/malli/pull/162

ikitommi18:01:46

comments welcome on that

ikitommi18:01:34

The goal is to have a unified api for creating Transformers: all are created via a function, instead of mixing functions and actual Transformer instances. So, instead of:

(mt/transformer
  mt/string-transformer
  mt/strip-extra-keys-transformer
  (mt/key-transformer
    {:decode #(-> % name (str "_key") keyword)
     :encode #(-> % name (str "_key"))}))
we should do:
(mt/transformer
  (mt/string-transformer)
  (mt/strip-extra-keys-transformer)
  (mt/key-transformer
    {:decode #(-> % name (str "_key") keyword)
     :encode #(-> % name (str "_key"))}))
… both work thou, thanks to auto-coercion of functions => Transformers.

ikitommi18:01:27

in other libs (schema, spec-tools) the json-transformer|matcher are just values, so people most likely try that instead of call the function. Not 100% happy with having the auto-coercion, but here thought the developer experience is more important than having an one explicit (non-familiar?) syntax.