On Fri, Oct 23, 2015 at 10:21 AM, <sebrautur...@gmail.com> wrote:

> We can read in the protocol documentation :
> "You can add new fields to your message formats without breaking
> backwards-compatibility; old binaries simply ignore the new field when
> parsing."
>
This is talking about protobuf binary before the JSON support is introduced
in proto3.


>
> It's not true with the json java parser in the 3.0.0-beta-1 version and
> we can have the following exception if a foo attribute is present in a json
> message and not present in the TestService.proto :
> Exception in thread "main"
> com.google.protobuf.InvalidProtocolBufferException: Cannot find field: foo
> in message TestService.TestMessage
>     at
> com.google.protobuf.util.JsonFormat$ParserImpl.mergeMessage(JsonFormat.java:1111)
>     at
> com.google.protobuf.util.JsonFormat$ParserImpl.merge(JsonFormat.java:1075)
>     at
> com.google.protobuf.util.JsonFormat$ParserImpl.merge(JsonFormat.java:973)
>     at
> com.google.protobuf.util.JsonFormat$Parser.merge(JsonFormat.java:201)
>     at test.Proto3Test.main(Proto3Test.java:73)
>
For JSON we are still trying to decide whether we should ignore unknown
fields or report errors as for text format. The current behavior may change
in the final release.


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

Reply via email to