Protobuf:更改消息名称会导致向后兼容错误吗?
Protobuf: can changing the message name lead to backward compatibility error?
假设我有以下 Protobuf MessageData:
message Person {
string name = 1;
int32 age = 2;
}
并且我想将消息名称从“Person”更改为“PersonNew”。如果我只在客户端更改protobuf版本,服务器会不会抛出不兼容的错误?
只要你不使用Any
类型,消息名称在数据格式中是不存在的,所以你可以随意更改。
假设我有以下 Protobuf MessageData:
message Person {
string name = 1;
int32 age = 2;
}
并且我想将消息名称从“Person”更改为“PersonNew”。如果我只在客户端更改protobuf版本,服务器会不会抛出不兼容的错误?
只要你不使用Any
类型,消息名称在数据格式中是不存在的,所以你可以随意更改。