Feature request: use idiomatic gRPC endpoint URLs
See original GitHub issueCurrently, when defining:
package com.example.ns {
@outputPackage("com.example.grpcns")
object protocol {
// ...
@service(Protobuf) {
trait MyService[F[_]] {
def myMethod(request: MyRequest): F[MyResponse]
}
}
}
the idlGen
command produces idiomatic gRPC code:
// ...
package com.example.grpcns;
// ...
service MyService {
rpc MyMethod (MyRequest) returns (MyResponse);
}
When using protoc
to generate client code for this, the client calls com.example.grpcns.MyService/MyMethod
as expected:
- with namespace
- with UpperCamelCase method name
But the Mu server will only accept MyService/myMethod
calls:
- without a namespace
- with lowerCamelCase method name
This seems to be non-idiomatic gRPC usage and breaks compatibility with IDL-generated clients.
Suggestions for the served gRPC endpoint URLs:
- Use the @outputPackage annotation to define the namespace.
- Capitalize the first letter of the method name.
Example project:
- https://github.com/sander/rpctest/tree/f45616a720091d88c06d0a5be00f5a2f4306f7aa doesn’t work, since the Go client tried to reach a prefixed and UpperCamelCase method
- https://github.com/sander/rpctest/tree/e018d5e5d1812b107d976aa7bbfb6617c223c761 does work, but now there is no namespace support and I needed to write UpperCamelCase in Scala which seems un-idiomatic
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Basics tutorial | Web
This tutorial provides a basic introduction on how to use gRPC-Web from browsers. By walking through this example you'll learn how to:.
Read more >grpc-ecosystem/awesome-grpc: A curated list of useful ...
Delivery - A simple electron app for gRPC that uses gRPCurl to autodetect all endpoints/methods and their request bodies, just modify the JSON...
Read more >Getting Started with ASP.NET Core and gRPC
Many have adopted gRPC due to its ability to provide Bi-directional streaming with HTTP/2 in a consistent yet language-idiomatic way. Leveraging ...
Read more >ServiceStack gRPC | Documentation
NET Core gRPC Endpoint requests where it makes use of Marc Gravell's code-first protobuf-net.Grpc library to enable ServiceStack's code-first development ...
Read more >Transcoding HTTP/JSON to gRPC - Cloud Endpoints
Cloud Endpoints supports protocol transcoding so that clients can access your gRPC API by using HTTP/JSON. The Extensible Service Proxy (ESP) transcodes ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@sander thanks again for your feedback. This issue has been accomplished in #622 and released with the
0.18.4
version (it’ll reach maven central soon)Now you can set the
idlGenIdiomaticEndpoints
setting key totrue
for generating scala service definitions that will append the namespace to the operations and their names will be capitalized.@sander we have added a couple of parameters to the
@service
annotation for controlling the service prefix and method name case. I’ve created a PR in your demo project to show how to configure it.We’re planning to add a new setting key to the idl plugin for controlling that when converting from
avdl
orproto
toscala
and update the docs. Once these two tasks are done, we’ll release a new version.