Use stream json api in protobuf 31 and later versions#32
Closed
chenBright wants to merge 1 commit into
Closed
Conversation
010ad87 to
50235ca
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the json2pb ProtoJSON conversion paths to use protobuf’s newer streaming JSON APIs when building against protobuf 6.31+, reducing intermediate buffering and leveraging the upstream JSON implementation directly.
Changes:
- Use
google::protobuf::json::MessageToJsonStreamfor ProtoMessage → ProtoJSON whenGOOGLE_PROTOBUF_VERSION >= 6031000. - Use
google::protobuf::json::JsonStreamToMessagefor ProtoJSON → ProtoMessage whenGOOGLE_PROTOBUF_VERSION >= 6031000. - Keep the existing
google::protobuf::util::{BinaryToJsonStream, JsonToBinaryStream}fallback for older protobuf versions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/json2pb/pb_to_json.cpp | Switch ProtoJSON serialization to protobuf’s streaming JSON API for protobuf 6.31+ with a fallback for older versions. |
| src/json2pb/json_to_pb.cpp | Switch ProtoJSON parsing to protobuf’s streaming JSON API for protobuf 6.31+ with a fallback for older versions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number:
Problem Summary:
What is changed and the side effects?
Changed:
Side effects:
Performance effects:
Breaking backward compatibility:
Check List: