Skip to content

proto codegen: Deprecated comments not generated for methods #3023

Closed
@carnott-snap

Description

@carnott-snap

In the following sample proto, we have decided that the Get rpc does not suit our needs so we have tagged it, and its input as deprecated:

syntax = "proto3";
package rolodex;

import "google/protobuf/timestamp.proto";

message Person {
  string name = 1;
  int32 id = 2;
  string email = 3;

  enum PhoneType {
    MOBILE = 0;
    HOME = 1;
    WORK = 2;
  }

  message PhoneNumber {
    string number = 1;
    PhoneType type = 2;
  }

  repeated PhoneNumber phones = 4;

  google.protobuf.Timestamp last_updated = 5;
}   
  
message Name {
  string name = 1;
} 

message Index {
  option deprecated = true;
  int32 id = 1;
}

service AddressBook {
  rpc Get(Index) returns (Person) {
    option deprecated = true;
  }
  rpc Search(Name) returns (Person);
}

github.com/golang/protobuf correctly deprecates the Index struct: (via go doc)

package rolodex

type Index struct {
	Id                   int32    `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}
    Deprecated: Do not use.

However when plugins=grpc is set, no deprecation warning is provided for AddressBookClient or AddressServer: (again, via go doc)

package rolodex

type AddressBookClient interface {
	Get(ctx context.Context, in *Index, opts ...grpc.CallOption) (*Person, error)
	Search(ctx context.Context, in *Name, opts ...grpc.CallOption) (*Person, error)
}
    AddressBookClient is the client API for AddressBook service.

    For semantics around ctx use and closing/ending streaming RPCs, please refer
    to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type AddressBookServer interface {
	Get(context.Context, *Index) (*Person, error)
	Search(context.Context, *Name) (*Person, error)
}
    AddressBookServer is the server API for AddressBook service.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions