例如,如果我从以下位置更改:
message Request {
int foo = 1;
}
Run Code Online (Sandbox Code Playgroud)
到
message Request {
int bar = 1;
int foo = 2;
}
Run Code Online (Sandbox Code Playgroud)
foo从 1 更改为 2安全吗?文档说不要:These numbers are used to identify your fields in the message binary format, and should not be changed once your message type is in use.,但我想知道为什么。
如果您有使用第一个版本生成的消息的序列化版本,则您将无法使用该消息的第二个版本进行反序列化。如果您使用 protobuf 生成模型以存储在数据库中或在 Apache Kafka 等代理中发布,则需要遵循约定。如果您使用 proto buffer 生成模型和服务以供在线使用,则不应破坏任何内容(如果您将重新生成所有模型)
| 归档时间: |
|
| 查看次数: |
4360 次 |
| 最近记录: |