Fork me on GitHub
#malli
<
2023-03-08
>
Joel20:03:19

I’m using mt/key-transformer {:encode keyword}, but I only want to decode keys to keywords if the corresponding schema key is a keyword (seems like this should be default)?

Joel20:03:53

I suppose all-or-none could work in my case. So I could “query” the schema if it’s using keyword keys.. It looks like :encode is only handed the key so it wouldn’t have the context to decide what to turn it into (keyword or leave as-is).

ikitommi07:03:03

by default, it encodes/decodes all keys. the transformers can see the schema, so it’s not hard to create a variant / option just to use the keys defined. m/strip-extra-keys-transformer is an example of looking into defined keys