Re: [protobuf] Json support in protobuf 3.0.0-beta-1

2015-10-06 Thread Gesly George
That's a fair point; though it would be good to have a clean way to create
a Message adapter for JSON parsers without re-implementing the
functionality in JsonFormat.

On Tue, Oct 6, 2015 at 6:24 PM Feng Xiao  wrote:

> On Tue, Oct 6, 2015 at 2:31 PM, Gesly George 
> wrote:
>
>>
>> I have been looking into ways in which the JsonFormat class can be used
>> to create a TypeAdapter that can be registered with Gson.
>> Writing out a Message object to JSON is not an issue but parsing a JSON
>> into Message object is a challenge as Gson TypeAdapter's read method
>> gives you a JsonReader as input.
>>
>> Internally, JsonFormat's merge method creates a JsonReader from
>> java.io.Reader, so if a merge method can take a JsonReader as input,
>> then it should be possible to create an appropriate TypeAdapter that can
>> be registered with Gson.
>>
>> Would it make sense to introduce a merge() method on JsonFormat that
>> takes a JsonReader. Something like
>>
>> public void merge(JsonReader json, Message.Builder builder);
>>
>>
>> Please let me know what you think.
>>
> The use of Gson is an implementation detail of the JsonFormat class. We
> are still exploring whether it meets our proto3 spec strictly and may
> replace it with other JSON parsers. For this reason it's probably not a
> good idea to expose it in public API.
>
>
>>
>>
>> On Monday, September 21, 2015 at 4:20:35 PM UTC-7, Feng Xiao wrote:
>>>
>>>
>>>
>>> On Mon, Sep 21, 2015 at 3:37 PM, Siddharth Chhabra <
>>> siddhart...@gmail.com> wrote:
>>>
 Quick question about the json support
 1. Will we get json support if we mix proto2 and proto3 syntax ? is
 that supported ?

>>> You can mix that only in a sub-set of the languages (languages with
>>> proto2 support: C++, Java, Python and Go). When converted to JSON,
>>> proto2-only features like extensions will be ignored completely.
>>>
>>>
 2. Since we are using extensions in proto2, can that be used as a
 member field  in a proto3 syntax file ?

>>> Not sure what you mean. You can import proto2 files in proto3 syntax
>>> files (again, only work when compiled into languages with proto2 support)
>>> and declare the type of a proto3 field to be a proto2 message, but you can
>>> not extend a proto3 message or declare an extension to a proto2 message in
>>> a proto3 syntax file.
>>>
>>>

 Please let us know.

 On Fri, Sep 11, 2015 at 5:35 PM, Feng Xiao  wrote:

>
>
> On Fri, Sep 11, 2015 at 5:23 PM, Siddharth Chhabra <
> siddhart...@gmail.com> wrote:
>
>> Was this added ?
>> I cant find the JsonFormat class in the api referenc
>> The JsonFormat class was mentioned in the thread "Will protobuf
>> support JSON?"
>>
>> The api is here :
>> https://developers.google.com/protocol-buffers/docs/reference/java/index
>> We are thinking of upgrading to protobuf 3 and want to make sure json
>> support is there since otherwise we dont have a need to upgrade.
>>
> Sorry, the Java doc hasn't been updated yet. You can find the
> JsonFormat class here:
>
> https://github.com/google/protobuf/blob/master/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
>
>
>
>>
>> Please let us know
>> Thanks
>>
>> --
>> 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 http://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 http://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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] protobuf objects versioning

2015-10-06 Thread Kutvuk
For JSON i use prefix version for different versions of our API: /v1/map 
... /v7/map

What is the best way to make versions of API?

-- 
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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Newest version of Protobuf that will work with Java and MSVC# 2008?

2015-10-06 Thread Dylan Justice
I've been trying for a good part of the day to build Protobuf v3.0.0-beta-1 
for C# in MSVS 2008 -- the most recent version of Visual Studio that can 
target my Smart Mobile Device hardware.  I'm starting to believe that this 
task is impossible.  The Cmake files don't seem to work, and the .SLN and 
.CSPROJ files appear to be v14, which can't be imported by MSVS v9.  

I haven't gone so far as to manually recreate VS2008 projects for Protobuf 
3 from scratch.  Has anyone here done this?

Assuming that this is a fool's errand, what's my best option for Protobuf 
compatibility between Java (Android) and VS2008 C#?

-- 
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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Json support in protobuf 3.0.0-beta-1

2015-10-06 Thread Gesly George

I have been looking into ways in which the JsonFormat class can be used to 
create a TypeAdapter that can be registered with Gson. Writing out 
a Message object to JSON is not an issue but parsing a JSON into Message 
object is a challenge as Gson TypeAdapter's read method gives you a 
JsonReader as input. 

Internally, JsonFormat's merge method creates a JsonReader from 
java.io.Reader, so if a merge method can take a JsonReader as input, then 
it should be possible to create an appropriate TypeAdapter that can be 
registered with Gson.

Would it make sense to introduce a merge() method on JsonFormat that takes 
a JsonReader. Something like 

public void merge(JsonReader json, Message.Builder builder);


Please let me know what you think.


On Monday, September 21, 2015 at 4:20:35 PM UTC-7, Feng Xiao wrote:
>
>
>
> On Mon, Sep 21, 2015 at 3:37 PM, Siddharth Chhabra  > wrote:
>
>> Quick question about the json support 
>> 1. Will we get json support if we mix proto2 and proto3 syntax ? is that 
>> supported ?
>>
> You can mix that only in a sub-set of the languages (languages with proto2 
> support: C++, Java, Python and Go). When converted to JSON, proto2-only 
> features like extensions will be ignored completely.
>  
>
>> 2. Since we are using extensions in proto2, can that be used as a member 
>> field  in a proto3 syntax file ?
>>
> Not sure what you mean. You can import proto2 files in proto3 syntax files 
> (again, only work when compiled into languages with proto2 support) and 
> declare the type of a proto3 field to be a proto2 message, but you can not 
> extend a proto3 message or declare an extension to a proto2 message in a 
> proto3 syntax file.
>  
>
>>
>> Please let us know. 
>>
>> On Fri, Sep 11, 2015 at 5:35 PM, Feng Xiao > > wrote:
>>
>>>
>>>
>>> On Fri, Sep 11, 2015 at 5:23 PM, Siddharth Chhabra <
>>> siddhart...@gmail.com > wrote:
>>>
 Was this added ?
 I cant find the JsonFormat class in the api referenc
 The JsonFormat class was mentioned in the thread "Will protobuf support 
 JSON?"

 The api is here : 
 https://developers.google.com/protocol-buffers/docs/reference/java/index
 We are thinking of upgrading to protobuf 3 and want to make sure json 
 support is there since otherwise we dont have a need to upgrade.

>>> Sorry, the Java doc hasn't been updated yet. You can find the JsonFormat 
>>> class here:
>>>
>>> https://github.com/google/protobuf/blob/master/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
>>>
>>>  
>>>

 Please let us know
 Thanks

 -- 
 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 http://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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Json support in protobuf 3.0.0-beta-1

2015-10-06 Thread 'Feng Xiao' via Protocol Buffers
On Tue, Oct 6, 2015 at 2:31 PM, Gesly George  wrote:

>
> I have been looking into ways in which the JsonFormat class can be used to
> create a TypeAdapter that can be registered with Gson. Writing
> out a Message object to JSON is not an issue but parsing a JSON into
> Message object is a challenge as Gson TypeAdapter's read method gives you
> a JsonReader as input.
>
> Internally, JsonFormat's merge method creates a JsonReader from
> java.io.Reader, so if a merge method can take a JsonReader as input, then
> it should be possible to create an appropriate TypeAdapter that can be
> registered with Gson.
>
> Would it make sense to introduce a merge() method on JsonFormat that takes
> a JsonReader. Something like
>
> public void merge(JsonReader json, Message.Builder builder);
>
>
> Please let me know what you think.
>
The use of Gson is an implementation detail of the JsonFormat class. We are
still exploring whether it meets our proto3 spec strictly and may replace
it with other JSON parsers. For this reason it's probably not a good idea
to expose it in public API.


>
>
> On Monday, September 21, 2015 at 4:20:35 PM UTC-7, Feng Xiao wrote:
>>
>>
>>
>> On Mon, Sep 21, 2015 at 3:37 PM, Siddharth Chhabra > > wrote:
>>
>>> Quick question about the json support
>>> 1. Will we get json support if we mix proto2 and proto3 syntax ? is that
>>> supported ?
>>>
>> You can mix that only in a sub-set of the languages (languages with
>> proto2 support: C++, Java, Python and Go). When converted to JSON,
>> proto2-only features like extensions will be ignored completely.
>>
>>
>>> 2. Since we are using extensions in proto2, can that be used as a member
>>> field  in a proto3 syntax file ?
>>>
>> Not sure what you mean. You can import proto2 files in proto3 syntax
>> files (again, only work when compiled into languages with proto2 support)
>> and declare the type of a proto3 field to be a proto2 message, but you can
>> not extend a proto3 message or declare an extension to a proto2 message in
>> a proto3 syntax file.
>>
>>
>>>
>>> Please let us know.
>>>
>>> On Fri, Sep 11, 2015 at 5:35 PM, Feng Xiao  wrote:
>>>


 On Fri, Sep 11, 2015 at 5:23 PM, Siddharth Chhabra <
 siddhart...@gmail.com> wrote:

> Was this added ?
> I cant find the JsonFormat class in the api referenc
> The JsonFormat class was mentioned in the thread "Will protobuf
> support JSON?"
>
> The api is here :
> https://developers.google.com/protocol-buffers/docs/reference/java/index
> We are thinking of upgrading to protobuf 3 and want to make sure json
> support is there since otherwise we dont have a need to upgrade.
>
 Sorry, the Java doc hasn't been updated yet. You can find the
 JsonFormat class here:

 https://github.com/google/protobuf/blob/master/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java



>
> Please let us know
> Thanks
>
> --
> 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 http://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 http://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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Newest version of Protobuf that will work with Java and MSVC# 2008?

2015-10-06 Thread 'Feng Xiao' via Protocol Buffers
On Sat, Oct 3, 2015 at 3:48 PM, Dylan Justice 
wrote:

> I've been trying for a good part of the day to build Protobuf
> v3.0.0-beta-1 for C# in MSVS 2008 -- the most recent version of Visual
> Studio that can target my Smart Mobile Device hardware.  I'm starting to
> believe that this task is impossible.  The Cmake files don't seem to work,
> and the .SLN and .CSPROJ files appear to be v14, which can't be imported by
> MSVS v9.
>
+Jon Skeet, what's the minimum Visual Studio version required for protobuf
C#?


>
> I haven't gone so far as to manually recreate VS2008 projects for Protobuf
> 3 from scratch.  Has anyone here done this?
>
> Assuming that this is a fool's errand, what's my best option for Protobuf
> compatibility between Java (Android) and VS2008 C#?
>
> --
> 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 http://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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.