If proto Foo and proto Bar are exactly the same except the name, can I use Bar to parse serialized Foo messages?

StackOverflow https://stackoverflow.com/questions/22338949

  •  13-06-2023
  •  | 
  •  

質問

If proto Foo and proto Bar are exactly the same except the name, can I use Bar to parse serialized Foo messages?

役に立ちましたか?

解決

Yes.

In general, you can always change names of things in protobufs without affecting the wire format, as long as you don't change numbers. (Though if you ever encode your protobuf to JSON or some similar encoding, names might matter there.)

In fact, Bar could even just contain a subset of the fields in Foo, since Protobuf backwards compatibility allows you to add and remove fields.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top