Schema Evolution

Evolving a proto message safely with reserved fields and new additions.

syntax = "proto3";

package shortener;

option go_package = "shortener/pb";

message Link {
  int64 id = 1;
  string url = 2;
  // field 3 was short_code, removed in v2
  reserved 3;
  reserved "short_code";

  int64 clicks = 4;
  string slug = 5;                          // added in v2
  string description = 6 [deprecated = true]; // deprecated in v3
  repeated string tags = 7;                 // added in v3
}

Old clients that still send field 3 won't cause errors. The server ignores it. New clients see slug and tags as empty/zero when reading old messages.

💻 Run locally

Copy the code above and run it on your machine

© 2026 ByteLearn.dev. Free courses for developers. · Privacy