Skip to content
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

Generated gRPC client method stubs get no comments or deprecation annotations #900

Closed
calmh opened this issue Nov 13, 2023 · 1 comment
Closed

Comments

@calmh
Copy link

calmh commented Nov 13, 2023

It would be nice if comments on rpc:s in the proto files were passed on as comments on generated method stubs. It would also be nice if option deprecated = true resulted in a @Deprecated annotation. Currently none of these things happen; for example,

// Deprecated: use GetLatestReportV2 (1.18.3)
rpc GetLatestReport(GetLatestReportRequest) returns (AerodromeReport) {
    option deprecated = true;
}

generates as

  $grpc.ResponseFuture<$8.AerodromeReport> getLatestReport($12.GetLatestReportRequest request, {$grpc.CallOptions? options}) {
    return $createUnaryCall(_$getLatestReport, request, options: options);
  }

which the client has no idea is deprecated, and gets no guidance from a comment.

@osa1
Copy link
Member

osa1 commented Dec 29, 2023

#908 implements generating deprecated annotations, #909 implements generating comments.

osa1 added a commit that referenced this issue Jan 8, 2024
This implements generating doc comments for enum types, enum values, rpc types,
and rpc methods.

Existing code for generating doc comments is refactored: the comment generator
handles trailing whitespace so we don't have to handle it in the call sites.
Comment generator is documented with the invariants: it never returns an empty
string (returns `null` instead) and never returns lines with trailing
whitespace.

To be able to test comment generating, a new kind of golden file test is added.
The difference from the other golden file tests is that this file is compiled
from .proto source instead of from a hand-crafted descriptor. This is because
attaching comments to proto field and types by hand is difficult and error
prone.

Fixes the comment part of #900.
@osa1 osa1 closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants