-
Notifications
You must be signed in to change notification settings - Fork 37
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
Feature request: use idiomatic gRPC endpoint URLs #599
Comments
I faced the same problem during implementing grpc health checks (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md) for our service deployed in Kubernetes. According to the doc above we need to specify concrete namespace
But it didn’t help me. I get the same error: @sander Did you solve the problem of specifying namespace somehow? |
@Chicker not yet. @fedefernandez said in Gitter chat that he’d try to prioritize this issue. Haven’t tried, but maybe this works as a workaround? trait `grpc.health.v1.Health`[F[_]] { |
@sander Thanks for the good suggestion! But it doesn't work, since the dot |
Thanks for the submission @sander. I'm currently working in this, I'll test it with your sample project. |
@sander we have added a couple of parameters to the We're planning to add a new setting key to the idl plugin for controlling that when converting from |
Thanks @fedefernandez! What will the new setting key be for exactly? |
I'm planning to add a flag that when active, it'll take the namespace defined in the avdl file and put it in the annotation namespace. It'll also set the method name style to capitalize. Still need a name though, ideas are welcomed 😉 |
@fedefernandez Is this still blocked on higherkindness/skeuomorph#85 ? Is there a (snapshot) version that can be used already? |
@sander sadly is still blocked. Couldn't find any spare time for addressing that. |
@sander thanks again for your feedback. This issue has been accomplished in #622 and released with the Now you can set the |
This PR addresses [sbt-mu-srcgen #93](higherkindness/sbt-mu-srcgen#93) along with an upcoming code-change PR for `sbt-mu-srcgen` and a documentation update PR for `mu-scala`. It does so by splitting the `useIdiomaticEndpoints` source-generation flag, created in [mu-scala #599](higherkindness/mu-scala#599) to control service method capitalization and package prefixes, into 2 distinct flags with different defaults: 1) `useIdiomaticGrpc` which controls the namespace prefix and defaults to `true`; 2) `useIdiomaticScala` which controls the endpoint capitalization and defaults to `false`. More formally, if `useIdiomaticScala` is true and if _all_ the RPC call definitions in an input IDL are capitalized, the Scala methods in the services generated from this IDL will be _de_-capitalized, while the gRPC endpoints derived from those will be re-capitalized to match the original IDL. For example, a Protobuf IDL `rpc GetBook` definition becomes a Scala `def getBook` method inside a `methodNameStyle = Capitalized` service, which then generates a `GetBook` gRPC endpoint. A `getBook` IDL definition (for example from Avro) would remain unchanged (`methodNameStyle = Unchanged`, `def getBook`, and `getBook` gRPC endpoint). The reason for the limitation that all RPC calls must be capitalized for the option to apply, is that we do not annotate individual methods, only the top-level `@service` annotation. Thus if we were to de-capitalize a mixed-capitalization group of calls and apply `methodNameStyle = Capitalized` to the service, some of the originally-lowercased methods would be incorrectly re-capitalized which is part of the issue we're addressing here (for example, `getBook` and `GetBook` would both become `def getBook` Scala and `GetBook` endpoints). Note that the PR also moves some test resources into the `resource` root, and normalizes them a bit between the Avro and Proto cases. I'm happy to provide some more background on the "idiomatic" flag's history as I understand it, in case it helps in reviewing this change. Feel free to ask about this or anything else unclear.
Currently, when defining:
the
idlGen
command produces idiomatic gRPC code:When using
protoc
to generate client code for this, the client callscom.example.grpcns.MyService/MyMethod
as expected:But the Mu server will only accept
MyService/myMethod
calls:This seems to be non-idiomatic gRPC usage and breaks compatibility with IDL-generated clients.
Suggestions for the served gRPC endpoint URLs:
Example project:
The text was updated successfully, but these errors were encountered: