Updating proto files
gRPC is a contract-first RPC framework. This means that the server and the client communicate with each other using a contract, which is defined in a proto file. Inevitably, the contract will change over time. In this section, we will learn how to update the contract and how to handle the changes in the server and the client.
Once a proto file is used in production, we need to consider backward compatibility when we update the proto file. This is because the existing clients may use the old version of the proto file, which may not be compatible with the new version of the proto file. If the new version of the contract is not backward compatible, the existing clients will break.
The following changes are backward compatible:
- Adding new fields to a request message: If the client does not send the new fields, the server can use the default values of the new fields.
- Adding new fields to a response message: If the response message contains the new...