-
Notifications
You must be signed in to change notification settings - Fork 15.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deprecated as a message-level option / annotation #1734
Comments
Drive by - Your last comment in the interesting part. It's sorta harder to say a message can be deprecated without looking at all of the uses. Deprecating it usually means there is something that should be used instead. If you can mark the message as deprecated without ensuring all uses have the alternate way, aren't you likely to create situations where the other messages are basically broken because they don't have the new way? |
You can already mark a message as deprecated by doing this: message MyMessage {
option deprecated = true;
...
} Actually you can pretty much use the deprecation annotation on all proto constructs: option deprecated = true; // file-level option
message MyMessage {
option deprecated = true; // message level
enum MyEnum {
option deprecated = true; // enum level
MY_ENUM_FOO = 1 [deprecated = true]; // enum-value
}
} This doesn't do anything useful in most implementations though (i.e., nothing is generated for this deprecated annotation), but if you can file separate requests per language if there is a standard way to do deprecation in that language. |
This one gives me a compile-error:
|
Does enum value deprecation: |
The new |
Wanted to note that |
Another note to the note above: |
Note for Go: adding |
Note for Java: adds @java.lang.Deprecated to generated source with "option deprecated = true;" |
* feat: proto3 optional support * chore: pre-release v6.11.0-pre * fix: rebuild * fix: fromObject should not initialize oneof members (protocolbuffers#1597) * test: adding test for pbjs static code generation * fix: fromObject should not initialize oneof members * chore: release v6.11.0 * chore: rebuild * feat: add --no-service option for pbjs static target (protocolbuffers#1577) This option skips generation of service clients. Co-authored-by: Alexander Fenster <fenster@google.com> * deps: set @types/node to >= (protocolbuffers#1575) * deps: set @types/node to star version When using `protobuf.js` as a dependency in a project it is important that `@types/node` package gets de-duped and has the same version as for the rest of the modules in the project. Otherwise, typing conflicts could happen as they do between v13 and v14 node types. * fix: use @types/node >=13.7.0 * fix: use @types/node >=13.7.0 Co-authored-by: Alexander Fenster <fenster@google.com> Co-authored-by: Alexander Fenster <github@fenster.name> * chore: rebuild * docs: update changelog * fix: parse.js "parent.add(oneof)“ error (protocolbuffers#1602) Co-authored-by: xiaoweili <xiaoweili@tencent.com> * chore: release v6.11.1 * fix(types): bring back Field.rule to .d.ts * fix: rebuild type, release v6.11.2 * build: configure backports * build: configure 6.x as default branch * fix: do not let setProperty change the prototype (protocolbuffers#1731) * fix(deps): use eslint 8.x (protocolbuffers#1728) * build: run tests if ci label added (protocolbuffers#1734) * build: publish to main * chore(6.x): release 6.11.3 (protocolbuffers#1737) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Support parsing of complex options * Use readValue to read the proto value and add better example * Fix lint issues * fix: rollback files * Re-do parse logic to take arrays into account and make it simpler Co-authored-by: Alexander Fenster <fenster@google.com> Co-authored-by: Matthew Douglass <5410142+mdouglass@users.noreply.github.com> Co-authored-by: Fedor Indutny <fedor.indutny@gmail.com> Co-authored-by: Alexander Fenster <github@fenster.name> Co-authored-by: leon <leon776@users.noreply.github.com> Co-authored-by: xiaoweili <xiaoweili@tencent.com> Co-authored-by: Benjamin Coe <bencoe@google.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There is currently no way of marking a whole message as deprecated.
My current workaround of doing this is to deprecate all fields.
... but it does not exactly mean the same thing, right ?
It would be great to be able to either mark the message with an option (does that even exist ?)
or an annotation ?
The other nice thing about deprecating the message itself would be that one would not need to find all its usages as field and mark all of them as deprecated fields.
The text was updated successfully, but these errors were encountered: