Skip to content

Commit

Permalink
Fallback to DebugString with lite protos
Browse files Browse the repository at this point in the history
Signed-off-by: Yan Avlasov <yavlasov@google.com>
  • Loading branch information
yanavlasov committed Mar 28, 2024
1 parent 6fd2297 commit 8729678
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions source/common/protobuf/utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -614,13 +614,19 @@ void MessageUtil::wireCast(const Protobuf::Message& src, Protobuf::Message& dst)
}

std::string MessageUtil::toTextProto(const Protobuf::Message& message) {
#if defined(ENVOY_ENABLE_FULL_PROTOS)
std::string text_format;
Protobuf::TextFormat::Printer printer;
printer.SetExpandAny(true);
printer.SetHideUnknownFields(true);
bool result = printer.PrintToString(message, &text_format);
ASSERT(result);
return text_format;
#else
// Note that MessageLite::DebugString never had guarantees of producing
// serializable text proto representation.
return message.DebugString();
#endif
}

bool ValueUtil::equal(const ProtobufWkt::Value& v1, const ProtobufWkt::Value& v2) {
Expand Down

0 comments on commit 8729678

Please sign in to comment.