Open lfolger opened 3 months ago
Maybe worth updating docs, depending on your bandwidth, of course @Logofile
ref: https://github.com/protocolbuffers/protobuf/issues/5390
Given the inconsistencies and the fact that Java/C++ don't accept the currently documented formatting, would it be reasonable to make all parsers accept both formattings?
C++ seems to fail if I try to feed it {"@type":"type.googleapis.com/google.protobuf.Empty","value":{}}
.
I think the only rational answer is that all parsers should accept both formats—for historical reasons. The only question is what should we align on the “canonical” preferred form.
Hi,
Is there any plan to address the inconsistency with how empty proto messages are handled across different languages (C++, Java, Python)? Consistency here is important for reliable cross-language usage.
Thanks!
See https://github.com/golang/protobuf/issues/1620 for full context.
The protobuf Go implementation gerates a different output and expects a different input when converting a google.protobuf.Empty proto nested in and google.protobuf.Any proto to and from JSON compared to C++, Java and Python.
According to the discussion on the issue, the Go protobuf implementation seems to be consistent with the spec but inconsistent with other languages.
Copying the relevant parts from the other issue:
(not using quotes here to keep the original formatting): start quote from dsnet:
The documentation for
google.protobuf.Any.value
says:Elsewhere, the documentation for
google.protobuf.Any
says:Then, the documentation for
google.protobuf.Empty
says:Thus, it seems that the current behavior is correct.
end quote
Is our interpretation/understanding of the documentation incorrect? Would it be reasonable to adjust the documentation to reflect the behavior of the C++/Java/Python? Alternatively, could the behavior of C++/Java be adjusted to align with the documentation? I assume this is cost prohibitive and even aligning the Go implementation with C++ and Java might not be easy.