Skip to content

Conversation

@darronschall
Copy link
Contributor

This changes mirrors the change I submitted to the original go twirp protoc plugin at arthurnn/twirp-ruby#97

Only append "Service" to the generated service class name when services are not properly named. This change avoids generating class names such as MessagesServiceService.

Strip a trailing "Service" from the service for better readability of the generated client class name. This avoids generating class names such as HelloWorldServiceClient.

```
./spec/support/create_fixture -b -f well_named_service_code_gen_request_pb.bin ./spec/fixtures/well_named_service.proto
```
This makes room for us to add additional `context`s, while keeping the spec file organized and separating the main `process` specs from the other helper methods.
Only append "Service" to the generated service class name when services are not properly named. This change avoids generating class names such as `MessagesServiceService`.

Strip a trailing "Service" from the service for better readability of the generated client class name. This avoids generating class names such as `HelloWorldServiceClient`.
```bash
protoc --plugin=protoc-gen-twirp_ruby=./exe/protoc-gen-twirp_ruby --ruby_out=. --twirp_ruby_out=. ./example/hello_world.proto
```

This further demonstrates that the "ServiceService" issue is fixed.
@darronschall darronschall force-pushed the improve-naming-for-well-named-services branch from b33e12b to 56f03a6 Compare May 10, 2024 17:08
@darronschall darronschall merged commit 355a11c into main May 10, 2024
@darronschall darronschall deleted the improve-naming-for-well-named-services branch May 10, 2024 17:14
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

Successfully merging this pull request may close these issues.

3 participants