protocol buffers - How to mark rpc as deprecated -


if have service this:

service myservice {   rpc getthings(getthingsrequest) returns (getthingsresponse); } 

how mark getthings deprecated?

i know how mark fields or messages deprecated can't find information rpcs.

this proto3.

tl;dr: it's possible, not generate compiler warning. consider use field-level deprecation.

it looks it's possible add deprecated option service, on message , enum like:

service myservice {   rpc getthings(getthingsrequest) returns (getthingsresponse) {     option deprecated = true;   }; } 

found in: https://github.com/google/protobuf/issues/1734

even though compile, not seem generate compiler warning when used. tried in java, helloworld service java quick start guide. inspecting generated java file further, helloworldproto.java, shows class has not added @deprecated java annotation, there differences in file, proto annotation in proto description:

$ diff helloworldproto-{control,method}.java 38c38 <       "ssage\030\001 \001(\t2i\n\007greeter\022>\n\010sayhello\022\030.hel" + --- >       "ssage\030\001 \001(\t2l\n\007greeter\022a\n\010sayhello\022\030.hel" + 40,41c40,41 <       "eply\"\000b6\n\033io.grpc.examples.helloworldb\017h" + <       "elloworldprotop\001\242\002\003hlwb\006proto3" --- >       "eply\"\003\210\002\001b6\n\033io.grpc.examples.helloworld" + >       "b\017helloworldprotop\001\242\002\003hlwb\006proto3" 

i got similar result when trying option on request message, service , file level well. hunch missing feature in java code generator. when adding deprecated option field, did wanted compiler warning:

$ ./gradlew installdist ... note: input files use or override deprecated api. ... 

your options see it:

  • mark fields in request message deprecated. going show compiler warnings uses it. like:

    message hellorequest {   string name = 1 [deprecated=true]; } 
  • use option deprecated on grpc method (as shown above) no compiler warnings shown, , rely on users see documentation.

  • open github issue.
  • all of above :)

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -