Search code examples
protocol-buffersgrpcproto

Is it fine to restore a reserved field in a proto definition?


Say I commented out a field in a proto definition and set the number in the reserved fields, but now I want to restore it. Can I take it out of reserved and assign the number back? Or should I use a new number. Are there any implications on the former?

e.g. If I want to use manufacturer again

message ProductDetail {
    reserved 2;
    string name = 1;   
    // string manufacturer = 2;
}

Solution

  • Yes, that's fine, as long as the meaning hasn't changed.