It would be nice if :map schemas like [:map [:foo :string] [:bar :string]] when decoding w/ the json-transformer a map value like {"foo" "whatever" "bar" "thingy"} turned those keys into keywords (or whatever other coerceable type is in the :map schema) similar to what e.g. [:map-of :keyword :string] does.
Sometimes this can be accomplished by adding in a key-transformer too but sometimes you don't want every key transformed the same way. And the :map schema already implicitly has all of the information you need to decode keys to their desired types (e.g. :my-key vs. "my-key").
You can currently work around this with a custom key schema and decoder fn and something like:
It would be nice if
:map
schemas like[:map [:foo :string] [:bar :string]]
when decoding w/ thejson-transformer
a map value like{"foo" "whatever" "bar" "thingy"}
turned those keys into keywords (or whatever other coerceable type is in the:map
schema) similar to what e.g.[:map-of :keyword :string]
does.Sometimes this can be accomplished by adding in a
key-transformer
too but sometimes you don't want every key transformed the same way. And the:map
schema already implicitly has all of the information you need to decode keys to their desired types (e.g.:my-key
vs."my-key"
).You can currently work around this with a custom key schema and decoder fn and something like:
...but it's a little clunky and redundant. The
:map
schema already contains all of the info necessary to do the proper decoding.I'd be happy to take a crack at implementing this if it seems desirable to others.