question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: use idiomatic gRPC endpoint URLs

See original GitHub issue

Currently, 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:

  1. Use the @outputPackage annotation to define the namespace.
  2. Capitalize the first letter of the method name.

Example project:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
fedefernandezcommented, Jul 8, 2019

@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 to true for generating scala service definitions that will append the namespace to the operations and their names will be capitalized.

1reaction
fedefernandezcommented, Apr 23, 2019

@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 or proto to scala and update the docs. Once these two tasks are done, we’ll release a new version.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found