How to put a string/int in an Any field?

181 views
Skip to first unread message

vole zheng

unread,
Nov 24, 2020, 3:15:56 AM11/24/20
to Protocol Buffers
Hello,
Suppose I have a message with an Any field. Could I put a string/int into the field, or I have to create a wrapper message for this?

Nishchit Dhanani

unread,
Dec 4, 2020, 1:17:37 AM12/4/20
to Protocol Buffers
Can you please share the sample proto as a reference? It is being hard to envision your case.

Hao Zheng

unread,
Jan 6, 2021, 10:56:40 AM1/6/21
to Nishchit Dhanani, Protocol Buffers
My proto could be very simple, like,
message ErrorStatus {
 
string message = 1;
 
repeated google.protobuf.Any details = 2;
}

I could put any proto in details, but could I put a string/int in details directly, or I have to create something like 'message IntProto { int value = 1}' to wrap the int data?

--
You received this message because you are subscribed to a topic in the Google Groups "Protocol Buffers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/protobuf/MQYa00ehHvY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/f9cbdacb-fcc7-4a0e-9322-ac47a9411dd1n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages