-
Notifications
You must be signed in to change notification settings - Fork 15.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java/C++/Python implementation inconsistent with proto json spec when marshaling empty proto in any proto #17099
Comments
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 |
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! |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment. This issue is labeled |
It seems like Java/C++/Python might be following the
That is, it renders the |
See golang/protobuf#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.
The text was updated successfully, but these errors were encountered: