[protobuf] Conversation of proto2 file to proto3

2016-08-07 Thread ערן אוצפ
Hello,  I'm new to protocol buffers,Ive been given a proto2 file the generate 
classes on my side (The receiving side). The problem is that my end is written 
in C#.  How should I approach this issue ?

I'm thinking i can write my own proto file in a proto3 syntax. But this can be 
a breading ground for incompatiblaty. 
Is there any proven tool which can do this for me ? 


-- 
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.


[protobuf] Convert .proto file from "proto2" to "proto3"

2016-08-07 Thread ערן אוצפ
Hello , 

Iv'e received a .proto file from a third party vendor which sends me 
notifications.

The problem is that my end is written is C# and iv'e the file is written to 
target "proto2". 


As i understand it 
  1) to generate C# classes from a .proto file the file has to be written 
in a "proto3" syntax. 
  2) "proto2" and "proto3" are compatible when used as two ends of a wire 
protocol, i.e. 
  
  Sender uses classes generated from a "proto2" file . 
  Receiver (me in this case) uses classes generated from a 
"proto3" file. 

1) are these assumption correct ? 
2) If so is there any tool i can use to convert the "proto2" file iv'e been 
given to a "proto3" file so i can generate C# classes on my end ?  

-- 
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.


Re: [protobuf] Creating ProtoBuf Messages without the generated proxy classes

2016-08-07 Thread Philipp Weissenbacher
Thanks for your repsonse Feng!

 We've ended up doing exactly that in Scala, actually.

Regards,
Philipp

Op vrijdag 5 augustus 2016 20:23:30 UTC+2 schreef Feng Xiao:
>
>
>
> On Thu, Aug 4, 2016 at 5:47 AM, Philipp Weissenbacher <
> philipp.we...@gmail.com > wrote:
>
>> Hi all,
>>
>> We are currently implementing a testing library. One goal is to allow the 
>> client to test sending and receiving ProtoBuf messages.
>> For this, we need a generic way to create them, without requiring the 
>> client to supply the generated proxy classes.
>> This means MyType.getDefaultInstance() (as suggested here 
>> )
>>  
>> would not work.
>>
>> So, is there a generic way to create ProtoBuf messages (e.g. from .proto 
>> files) at runtime?
>>
> If you are using C++, you can use the Importer class:
>
> https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/importer.h#L148
>
> to parse .proto files to FileDescriptor and then use DynamicMessage to 
> create message instances:
>
> https://github.com/google/protobuf/blob/master/src/google/protobuf/dynamic_message.h#L118
>
> After that you can parse/serialize and manipulate the message instances 
> using the reflection API:
>
> https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message#Reflection
>
>  
>
>>
>> BTW, we're using Scala/Java and protobuf2.
>>
>> Sincerely,
>> Philipp
>>
>> -- 
>> 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+u...@googlegroups.com .
>> To post to this group, send email to prot...@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.