Closed billtuba closed 1 year ago
Oh, I see. This is a bug. We are composing :map-of
transformers via m/-comp
and it has worked before as everything was defined as a function. :enum
transformer is a real interceptor, so we should compose it with m/-intercepting
. This should be easy to fix.
That said, I think the :map-of
transformer is not working correctly anyways as it currently forcefully transforms keys into strings first, giving wrong results:
(m/decode
[:map-of :int :int]
{:kikka :kukka}
(mt/json-transformer))
; => {"kikka" :kukka}
Like :or
, it should validate the results after applying key transformation, if not valid, keep the original value.
Fixed the thing ikitommi mentioned. New behaviour:
(m/decode
[:map-of :int :int]
{:kikka :kukka}
(mt/json-transformer))
; => {:kikka :kukka}
Thanks for getting this in!
Found in version :
0.10.0
Previously working in :0.9.2
Reproducible in
master
: yes Given schema:When I run this:
decode
under v0.9.2
behaves properly:decode
using v0.10.0
does not:transforming_enums.clj.zip
N.B. If remove/comment out the
:enum/:=
entries in-json-decoders
the code behaves as expected.