I was wondering if there has been any talk or plan to make TextFormat and 
JsonFormat extensible. For example, we are writing code to log input and 
output protos for gRPC services. In our case, we need to filter certain 
sensitive fields (which we currently mark via custom options in the proto 
file). Ideally, we'd be able to subclass the Printer and use most of the 
logic in JsonFormat or TextFormat. However, the important methods are 
currently private, such as:

https://github.com/google/protobuf/blob/baed06e69443613c531a3580315759c08db6667e/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java#L956-L958
https://github.com/google/protobuf/blob/baed06e69443613c531a3580315759c08db6667e/java/core/src/main/java/com/google/protobuf/TextFormat.java#L385-L388

Instead, we need to re-implement most of the logic in our own formatter 
class. I was also a little surprised to find that the two Printers don't 
share an interface, allowing others to more easily add custom printers.

Is this something that has come up before? Or maybe we're off the beaten 
path?

Thanks,
Paul

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to