Ok thanks, I was trying to avoid this, to compile and use the generated
classes. Now we are currently processing the raw protobuf message as a map
of UnknownFieldSet, and I was wondering if there was a choice to make this
"rewrite" without the need to compile and use the class, just traversing
As the very first step you should compile your schema and work with the
generated classes:
https://protobuf.dev/getting-started/javatutorial/#compiling-protocol-buffers
Don't mess with the reflection API if you can avoid it.
On Wednesday, September 20, 2023 at 12:19:38 PM UTC+2 Joan
Hi Florian,
Not sure what I can do with this code. I only have a byte array
representing the above protobuf, I don't have any object or message. At
most I have a map with the list of the "UnknownFieldSet.Field" fields after
parsing the byte array (this is java code).
I'm relatively new to
Messages are serialized with a length delimiter, so changing the content
produces a mismatch and invalid message.
Your schema has no affected repeated fields, so appending a delta should
work. I've never used the C# API, but here is some hopefully understandable
pseudo code:
var delta =
Hi Florian,
Thanks for your quick response. I'm stuck on this.
1) It's not working. When I send the protobuf to the backend server (it's
not our api nor server) using the first method, I get a right response. But
using the second method I receive this error:
ProtoBuf.ProtoException: Invalid
1) A "varint" is a "variable length integer". When you replace a large
number with a small one, it's entirely possible to lose some bytes and
still be valid. You need to check the actual output.
2) Can you provide the proto definition of the field you want to modify?
Scalar fields get set to
Hello,
I have a protobuf message like this into a byte array:
1: { // META element
1: 2
2: 1
3: 1
4: {// CutOffTime element within META
1: 10
2: 3
}
5: 1
6: