Hi Ivan,

You are doing it correctly. An empty message has zero length when
serialized. This is also true for messages with only optional fields - an
empty array of bytes is a valid serialized instance of such a message.

-Nadav

On Fri, Feb 5, 2021 at 12:57 PM Ivan Baidakou <[email protected]> wrote:

>
> Hi,
>
> There is a the following message type:
>
> message Ping {}
>
> When I invoke for my  object  "proto::Ping &ping" the ping.ByteSizeLong()
> it returns zero. ping.SerializeAsString() also returns empty string.
>
> What can be done?
>
> Thank you,
> wbr, basiliscos
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/c5cfa7ca-bd7f-47b5-a993-0427b0e04d06n%40googlegroups.com
> <https://groups.google.com/d/msgid/protobuf/c5cfa7ca-bd7f-47b5-a993-0427b0e04d06n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
-Nadav

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CANZcNEqfOXWSXnwG1Lwd59_no-kN9D1Vvngz5mPRJ2Rsd2oRdg%40mail.gmail.com.

Reply via email to