0

I currently have two proto files. foo.proto and bar.proto, foo.proto is already importing types from bar.proto However, I now need to make a change where bar.proto needs to use a message defined in foo.proto.

I moved the message definition from foo to bar but now I need to figure out the best way of deprecating the message from foo since it was removed it need to be reserver/deprecated.

1 Answers1

0

I'm not sure there's a (proto3) specific way to annotate messages as deprecated and the principle is different to a deprecated field in a message.

NOTE: Even with fields deprecated is more documentary, only treated as guidance and not necessarily enforced.

This answer is for proto2 but I've not used it and can't vouch for it.

I assume (!) that you need to retain the message in foo for existing code. If there are no dependencies, simply exclude (comment out) the message from foo and explain why.

As there appears no formal mechanism, I think you're going to have to rely on comments and hope that other developers respect the request.

NOTE: I'm unsure of the consequences of recursive dependencies (foo depending on bar and vice versa) but this is likely something you should try to avoid.

halfer
  • 19,824
  • 17
  • 99
  • 186
DazWilkin
  • 32,823
  • 5
  • 47
  • 88