malli

https://github.com/metosin/malli :malli:
ikitommi 2020-07-18T07:49:08.174900Z

final(?) cleanup for transformers: https://github.com/metosin/malli/pull/224

ikitommi 2020-07-18T07:49:44.175500Z

big change is that collection transformers don't coerce their type if children don't need transformation. In practise:

(m/decode [:vector keyword?] '("abba") (mt/json-transformer))
; => [:abba]

(m/decode [:vector string?] '("abba") (mt/json-transformer))
; => ("abba")

ikitommi 2020-07-18T07:50:48.176200Z

for string-transformer, works like before:

(m/decode [:vector string?] '("abba") (mt/string-transformer))
; => [:abba]

ikitommi 2020-07-18T07:52:16.177800Z

=> the transformer instances can decide how to transform the collections, with JSON, both Jsonista and Cheshire decode JSON arrays as vectors, so they don’t need any “just in case” transformations.

ikitommi 2020-07-18T07:53:19.179Z

if you have a deep Malli Schema, which only has things that can be presented in JSON, the transformation engine return identity. Which is nice.