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

Disambiguate names of service methods in grpc output #487

Closed
wants to merge 4 commits into from

Conversation

sigurdm
Copy link
Collaborator

@sigurdm sigurdm commented Mar 2, 2021

Fixes: #485

Copy link
Contributor

@nichite nichite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM

..._serviceNames,
];

final List<String> _serviceNames = <String>[
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be const? Also, do we need the explicit type on the left-hand side?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes!

Done - also in surrounding code.

@@ -30,6 +30,18 @@ class TestClient extends $grpc.Client {
'/Test/Bidirectional',
($0.Input value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.Output.fromBuffer(value));
static final _$new_ = $grpc.ClientMethod<$0.Input, $0.Output>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I was curious of, is it possible to have a name collision with the library import aliases? i.e. do we also need to add r'$grpc', r'$async' etc to the reserved words?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ cannot occur in a protobuf identifier, (https://developers.google.com/protocol-buffers/docs/reference/proto3-spec#identifiers) - I also tried it out and the protoc compiler gave a syntax error.

I believe that is why we chose to use $ in the first place for these names.

That means we could actually remove all the reserved words with $!

I won't do that in this PR to keep the scope smaller.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I removed it from those added).

@sigurdm
Copy link
Collaborator Author

sigurdm commented Mar 4, 2021

I realized we also needed disambiguation for the .pbserver.dart code, and added that - this will require a bit of integration work when moving into google3.

@nichite @iinozemtsev do you know if we have any real uses of the pbserver.dart files internally? Searching for 'import.*.pbserver.dart' gives no real results. Maybe it is time to retire that code, and have the grpc code be generated by default?

@nichite
Copy link
Contributor

nichite commented Mar 4, 2021

I agree with retiring the .pbserver files, I don't see any internally. I was thinking the same thing about the generated RPC client stubs that protobuf puts out that aren't functional. For those, there are one or two subclassed internally, but I was thinking they both could just be replaced by gRPC.

@nichite nichite self-requested a review March 4, 2021 18:31
Copy link
Contributor

@nichite nichite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sigurdm sigurdm closed this Mar 5, 2021
@sigurdm sigurdm reopened this Mar 5, 2021
@kevmoo kevmoo deleted the branch google:null_safety July 27, 2021 17:23
@kevmoo kevmoo closed this Jul 27, 2021
@osa1
Copy link
Member

osa1 commented Apr 13, 2022

Why was this PR closed @sigurdm @kevmoo ? Might be good to revive this as it fixes an issue (#485).

@kevmoo
Copy link
Collaborator

kevmoo commented Apr 15, 2022

Possible I was doing branch cleanup and didn't realize this was NOT the null safety migration branch.

@sigurdm
Copy link
Collaborator Author

sigurdm commented Apr 22, 2022

Why was this PR closed @sigurdm @kevmoo ? Might be good to revive this as it fixes an issue.

Yeah good question, we should try and revive it. Not trivial without the branch...

@sigurdm
Copy link
Collaborator Author

sigurdm commented Apr 22, 2022

Reconstructed in #625

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants