Skip to content

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Sep 24, 2024

Motivation:

A 'bar' package defining a 'FooService' service will have a number of types generateed for it, for example, Bar_FooServiceServiceProtocol, or Bar_FooServiceClient. The protocol buffers style guide reccomends that services are suffixed with "Service" (e.g. "FooService", not "Foo") which results in some strange protocol names (like Bar_FooServiceServiceProtocol).

There should be a clearer differentiation between the qualified service name ("bar.FooServce") and the type being generated. The code generator already replaces "." with "" in fully qualified names, so "" is a natural choice as a separator.

Modifications:

  • Add an "_" between the generated fully qualified service name and the gRPC component being generated
  • Update tests

Result:

Better names in generated code.

The Bar_FooServiceServiceProtocol example above becomes Bar_FooService_ServiceProtocol, while Bar_FooServiceClient becomes Bar_FooService_Client.

Motivation:

A 'bar' package defining a 'FooService' service will have a number of types
generateed for it, for example, `Bar_FooServiceServiceProtocol`, or
`Bar_FooServiceClient`. The protocol buffers style guide reccomends that
services are suffixed with "Service" (e.g. "FooService", not "Foo")
which results in some strange protocol names (like
`Bar_FooServiceServiceProtocol`).

There should be a clearer differentiation between the qualified service
name ("bar.FooServce") and the type being generated. The code generator
already replaces "." with "_" in fully qualified names, so "_" is a
natural choice as a separator.

Modifications:

- Add an "_" between the generated fully qualified service name and the
  gRPC component being generated
- Update tests

Result:

Better names in generated code.

The `Bar_FooServiceServiceProtocol` example above becomes
`Bar_FooService_ServiceProtocol`, while `Bar_FooServiceClient` becomes
`Bar_FooService_Client`.
Copy link
Collaborator

@gjcairo gjcairo left a comment

Choose a reason for hiding this comment

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

LGTM - thanks George! This reads much more clearly.

A super nit for posterity, not really about the change itself: the underscore in the PR description is being rendered as markdown/italics 😅 can you escape it so it reads better if someone comes looking in the future?

@glbrntt glbrntt merged commit c8d5500 into grpc:main Sep 25, 2024
5 of 8 checks passed
glbrntt added a commit to glbrntt/grpc-swift that referenced this pull request Sep 25, 2024
Motivation:

In grpc#2072 the code gen was changed to add an underscore to the generated
names. This wasn't picked up in CI because the examples depend on "main"
at the moment.

Modifications:

- Update examples

Result:

CI passes
@glbrntt glbrntt mentioned this pull request Sep 25, 2024
glbrntt added a commit that referenced this pull request Sep 25, 2024
Motivation:

In #2072 the code gen was changed to add an underscore to the generated
names. This wasn't picked up in CI because the examples depend on "main"
at the moment.

Modifications:

- Update examples

Result:

CI passes
@rnro rnro mentioned this pull request Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚠️ semver/major Breaks existing public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants