Issue 329 in protobuf: Add support for [deprecated = true] on all types of definitions

6,708 views
Skip to first unread message

prot...@googlecode.com

unread,
Sep 9, 2011, 3:44:56 PM9/9/11
to prot...@googlegroups.com
Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 329 by Grigand: Add support for [deprecated = true] on all types
of definitions
http://code.google.com/p/protobuf/issues/detail?id=329

Please consider adding the ability to deprecate all types. i.e.

message DeprecatedMessage {
//deprecate the message
option deprecated = true;
...
}

enum DeprecatedEnum {
//deprecate the enumeration
option deprecated = true;
...
//deprecate an enumeration value
one = 1 [deprecated = true];
}

service DeprecatedService {
//deprecate an entire service api
option deprecated = true;
...
//deprecate a service method
rpc Method(Request) returns (Response) [deprecated = true];
}

//maybe even support deprecating an entire file:
option deprecated = true;

prot...@googlecode.com

unread,
Mar 13, 2013, 12:44:44 PM3/13/13
to prot...@googlegroups.com

Comment #1 on issue 329 by sergei.s...@gmail.com: Add support for
[deprecated = true] on all types of definitions
http://code.google.com/p/protobuf/issues/detail?id=329

Yes, please, that would be really helpful as our proto messages evolve over
time.

I have just been told by protoc compiler that enum values could not be
deprecated, that was rather disappointing to hear.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

prot...@googlecode.com

unread,
Mar 13, 2013, 2:13:13 PM3/13/13
to prot...@googlegroups.com

Comment #2 on issue 329 by xiaof...@google.com: Add support for [deprecated
= true] on all types of definitions
http://code.google.com/p/protobuf/issues/detail?id=329

What's the effect of a filed or file being declared as deprecated? How can
it help a message evolve?

prot...@googlecode.com

unread,
Mar 13, 2013, 2:36:38 PM3/13/13
to prot...@googlegroups.com

Comment #3 on issue 329 by sergei.s...@gmail.com: Add support for
[deprecated = true] on all types of definitions
http://code.google.com/p/protobuf/issues/detail?id=329

Deprecation is an integral part of evolution. Say, we introduce a new field
in version 1.5, then a few months down the line, we no longer need it. We
deprecate it in the next version, say that will be 1.12. We ship version
1.12 to the consumers and ask them to remove references to the deprecated
field. In version 2.0 we remove the field from the message completely.

The current version of protoc produces @Deprecated annotations in java
classes for fields marked with [deprecated = true], which in turn produces
a visible warning when some other java code is referencing the deprecated
members of the message or builder class.

I am not sure what would be the implication of deprecating the entire proto
file. I can think of two possible (complementary, not mutually exclusive)
options:
1) protoc outputs a warning whenever a deprecated file is being imported
2) protoc automatically treats all messages defined in the file as
deprecated and generates annotations to that effect

Sumit Kumar

unread,
Mar 13, 2013, 10:29:52 PM3/13/13
to codesite...@google.com, prot...@googlegroups.com
Can we insert compiler warning for C++ builds as well in cases where deprecated field is used ?

Regards,
Sumit Kumar
> You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
> To post to this group, send email to prot...@googlegroups.com.
> Visit this group at http://groups.google.com/group/protobuf?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

prot...@googlecode.com

unread,
Oct 13, 2014, 6:52:09 PM10/13/14
to prot...@googlegroups.com
Updates:
Status: Fixed
Owner: xiaof...@google.com
Labels: FixedIn-2.6.0

Comment #4 on issue 329 by xiaof...@google.com: Add support for [deprecated
= true] on all types of definitions
https://code.google.com/p/protobuf/issues/detail?id=329

The "deprecated" annotation is supported on all types in 2.6.0 release.
Reply all
Reply to author
Forward
0 new messages