protoc-gen-grpc-gateway-ts icon indicating copy to clipboard operation
protoc-gen-grpc-gateway-ts copied to clipboard

Support for annotating deprecated fields

Open samstradling opened this issue 2 years ago • 0 comments

If a field is deprecated in the proto definitions, such as

message MyMessage {
  string field_a = 1;
  string field_b = 2 [deprecated = true];
}

Would it be possible to add a deprecated annotation to the generated types:

export type MyMessage = {
  fieldA?: string
  /**
   * @deprecated
   */
  fieldB?: string[]
}

If it did, the typescript compiler picks this up giving a warning: Screenshot 2022-07-08 at 18 40 35

This is useful when deprecating an old field (and often moving to a new one) in a large codebase as it gives a visual indication where the old one is used.

samstradling avatar Jul 08 '22 17:07 samstradling