-
Notifications
You must be signed in to change notification settings - Fork 165
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
Support generating kotlin bindings #270
Comments
The intent is that choosing to use gRPC-Kotlin and choosing to use Kotlin protos should be completely independent, and it is -- you can use one or the other, or both. |
My understanding is that grpc-kotlin generates the proto bindings as well for bazel anyway. There's a PR that fails to use the new bindings in bazel for instance: #266 I think this PR should fix it: #271 FWIW, we tried updating rules_proto to use the newer version but the kotlin DSL don't seem to be generated either. |
The Kotlin proto generated code effectively just adds a type-safe builder DSL to the Java protos. The current code generated by grpc-kotlin can accept proto messages built using this. In terms of the Bazel rule implementation, the rule requires the caller to pass in a |
I'm working on generating some Kotlin to integrate grpc-kotlin more closely with the protobuf generated Kotlin DSL. For every (non-streaming) RPC, I would generate a function like the following: suspend fun rpcMethodName(
headers: Metadata = Metadata(),
builder: RequestMessageKt.Dsl.() -> Unit
): ResponseMessage =
rpcMethodName(requestMessage(block), headers) This function allows a client to call the RPC building the request message in a less verbose form: serviceStub.rpcMethodName {
fieldOne = valueOne
fieldTwo = valueTwo
} Rather than the current syntax: serviceStub.rpcMethodName(
requestMessage {
fieldOne = valueOne
fieldTwo = valueTwo
}
) I've been using functions like this in my projects for quite a while and appreciate the less verbose calls. Would a pull request that introduces these function overloads have a chance of being accepted? These functions introduce a dependency on the protobuf generated Kotlin DSL. |
It is specifically intended that we do not have a dependency from gRPC-Kotlin to Kotlin protos, which is why things are the way they are today. |
Now that protocolbuffers/protobuf#3742 is resolved and the protoc can generate some Kotlin bindings, can we support this in grpc-kotlin as well?
The text was updated successfully, but these errors were encountered: