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

Use nested protocols #2132

Merged
merged 2 commits into from
Nov 27, 2024
Merged

Use nested protocols #2132

merged 2 commits into from
Nov 27, 2024

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Nov 26, 2024

Motivation:

The minimum Swift version we require supports protocols being declared within another type. This means that all protocols and types we generate for a service can be declared within the enum namespace for that service and we can remove the typealiases.

Modifications:

  • Declare generated protocols within their enum namespace
  • Inline generated service descriptors

Result:

Simpler generated code

Motivation:

The minimum Swift version we require supports protocols being declared
within another type. This means that all protocols and types we generate
for a service can be declared within the enum namespace for that service
and we can remove the typealiases.

Modifications:

- Declare generated protocols within their enum namespace
- Inline generated service descriptors

Result:

Simpler generated code
@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Nov 26, 2024
@glbrntt glbrntt enabled auto-merge (squash) November 26, 2024 15:21
@glbrntt
Copy link
Collaborator Author

glbrntt commented Nov 26, 2024

API breakage is a false positive, it's on package level API

@glbrntt glbrntt disabled auto-merge November 26, 2024 16:17
) -> Self {
return VariableDescription(
accessModifier: accessModifier,
isStatic: true,
kind: .let,
left: .identifierPattern("descriptor"),
right: .identifier(.type(.serviceDescriptor)).dot(namespacedProperty)
right: .functionCall(.serviceDescriptor(literalFullyQualifiedService: name))
Copy link
Collaborator

Choose a reason for hiding this comment

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

The example has both package and service parameters on the right but the code doesn't seem to reflect that at least to my inexpert eye.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're absolutely right, I had an intermediary change which the docs were correct for, I just forgot to update them when I landed on the final change. Good spot!

@glbrntt glbrntt merged commit 12a7366 into grpc:main Nov 27, 2024
42 of 45 checks passed
@glbrntt glbrntt deleted the v2/04a-nested-protocol branch November 27, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants