Skip to content

Add more documentation about code generation #83

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Jul 30, 2025

Motivation:

Users (especially new ones) often have issues with generating code. This package provide a number of ways to do this but doesn't do a good job of explaining the pros and cons of each method or how to use each of them.

Modifications:

  • Split up the generating stubs doc into four parts: one article for each method explaining how to use that approach. For the build plugin and protoc the content was more or less directly moves from the existing doc.
  • Reprurpose the existing generating stubs doc to explain the pros and cons of each approach to make it easier for users to decide.

Result:

Better docs

Motivation:

Users (especially new ones) often have issues with generating code. This
package provide a number of ways to do this but doesn't do a good job of
explaining the pros and cons of each method or how to use each of them.

Modifications:

- Split up the generating stubs doc into four parts: one article for
  each method explaining how to use that approach. For the build plugin
  and protoc the content was more or less directly moves from the
  existing doc.
- Reprurpose the existing generating stubs doc to explain the pros and
  cons of each approach to make it easier for users to decide.

Result:

Better docs
@glbrntt glbrntt added the semver/none No version bump required. label Jul 30, 2025
@glbrntt glbrntt requested a review from gjcairo July 30, 2025 16:57
@glbrntt glbrntt enabled auto-merge (squash) July 30, 2025 16:57
protoc --plugin=/path/to/protoc-gen-grpc-swift-2 --grpc-swift-2_out=. my-service.proto
```

You can also specify various option the `protoc-gen-grpc-swift-2` via `protoc` using
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
You can also specify various option the `protoc-gen-grpc-swift-2` via `protoc` using
You can specify an option to the `protoc-gen-grpc-swift-2` plugin via `protoc` using

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 think neither of these are right 😀

Comment on lines +26 to +27
> `protoc-gen-grpc-swift-2` only generates gRPC stubs, it doesn't generate messages. You must use
> `protoc-gen-swift` to generate messages in addition to gRPC Stubs.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm unsure about this, but should we maybe put this at the top of this section and slightly rephrase it to something like "you should first make sure you've generated your proto messages by using protoc-gen-swift before generating gRPC Stubs?

I just feel like if you're completely new to all of this, this paragraph may be confusing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It doesn't matter which order they're generated in, it can be before or after generating gRPC stubs. I think this is in the right place because the paragraph above sets the scene by explaining that we provide a plugin for protoc which generates the gRPC bits. This is just making it more explicit that it only generates the gRPC bits.

protoc --grpc-swift-2_opt=<OPTION_NAME>=<OPTION_VALUE> --grpc-swift-2_out=.
```

You can specify multiple options by passing the `--grpc-swift-2_opt` argument multiple times:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
You can specify multiple options by passing the `--grpc-swift-2_opt` argument multiple times:
You can also specify multiple options by passing the `--grpc-swift-2_opt` argument multiple times:

Comment on lines +26 to +27
> `protoc-gen-grpc-swift-2` only generates gRPC stubs, it doesn't generate messages. You must use
> `protoc-gen-swift` to generate messages in addition to gRPC Stubs.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It doesn't matter which order they're generated in, it can be before or after generating gRPC stubs. I think this is in the right place because the paragraph above sets the scene by explaining that we provide a plugin for protoc which generates the gRPC bits. This is just making it more explicit that it only generates the gRPC bits.

protoc --plugin=/path/to/protoc-gen-grpc-swift-2 --grpc-swift-2_out=. my-service.proto
```

You can also specify various option the `protoc-gen-grpc-swift-2` via `protoc` using
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 think neither of these are right 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/none No version bump required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants