AppsFlyer / pronto

Clojure support for protocol buffers
110 stars 8 forks source link

xform is being applied after the default mapper on proto-map->clj-map #35

Open thiagocarvp opened 6 months ago

thiagocarvp commented 6 months ago

I'm trying to use the xform argument on the proto-map->clj-map function to handle proto-maps that have fields using one-of.

However, the xform is being applied after the default mapper, so it cannot access the proto-map. Is this order supposed to be this way? https://github.com/AppsFlyer/pronto/blob/df3f76fa1a58727e07f11a5eb74a2066f637ff90/src/clj/pronto/core.clj#L122

If the xform is meant to be the first transducer, it should be:

(comp xform mapper)

Reference from Clojure docs: https://clojure.org/reference/transducers#_defining_transformations_with_transducers