One possible work around would be to run protoc with --descriptor_set_out
to just parse the .proto files and generate descriptors, and then your
program could read in the descriptors without needing to use the plugin
interface. Would that work well for your situation? Otherwise, your idea of
using oneof sounds like it could be a reasonable option.

On Wed, Feb 15, 2017 at 7:13 AM, Martin Richard <martius...@gmail.com>
wrote:

> Hi,
>
> I am writing a protoc plugin which outputs documentation files from
> protobuf sources in python.
>
> I would like to produce binary files (a PNG image with a nice diagram),
> however, this is impossible because CodeGeneratorResponse.File.content is
> a "string" field, rather than a "bytes" field, which must be a valid UTF-8
> string in python 3.
> (see: https://github.com/google/protobuf/blob/
> 607b92149948393311d66329b9851f5971662f19/src/google/
> protobuf/compiler/plugin.proto#L160)
>
> Does anyone see a way to work around this limitation? At the moment, I
> embed my images in base64 in the produced files, but that's not exactly the
> kind of solution I'm looking for.
>
> If not, would anyone be interested in allowing to produce binary files?
> It can probably be implemented in a backward compatible way using
> something oneof { string content, bytes raw_content }.
>
> Cheers,
> Martin
>
> --
> 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 protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to