pronto icon indicating copy to clipboard operation
pronto copied to clipboard

encoder: allow encoders for top-level proto?

Open mping-exo opened this issue 1 year ago • 0 comments

Related to #22.

I think it would be useful to allow encoders for top-level protobuf objects:

(defmapper mapper [ObjectReference]
           :encoders {ObjectReference
                      {:from-proto (fn [^ObjectReference proto-obj] ...)
                       :to-proto   (fn [clj-map] ...)}})

This would be useful for cases where we want to use a clojure type that has no native representation in protobuf, such as keywords or UUIDs. Besides, it would make the library more orthogonal, since it already supports mappings for nested types.

mping-exo avatar Apr 04 '24 13:04 mping-exo