Skip to content
Snippets Groups Projects
Commit f31a80ea authored by Yang Gao's avatar Yang Gao Committed by GitHub
Browse files

Merge pull request #10950 from jeady/service_name_metadata

Add static method to generated code to return fully qualified protobuf service name
parents c2ad372d be6ccdbc
No related branches found
No related tags found
No related merge requests found
......@@ -804,6 +804,12 @@ void PrintHeaderService(grpc_generator::Printer *printer,
" public:\n");
printer->Indent();
// Service metadata
printer->Print(*vars,
"static constexpr char const* service_full_name() {\n"
" return \"$Package$$Service$\";\n"
"}\n");
// Client side
printer->Print(
"class StubInterface {\n"
......
......@@ -69,6 +69,9 @@ namespace testing {
// ServiceA leading comment 1
class ServiceA final {
public:
static constexpr char const* service_full_name() {
return "grpc.testing.ServiceA";
}
class StubInterface {
public:
virtual ~StubInterface() {}
......@@ -373,6 +376,9 @@ class ServiceA final {
// ServiceB leading comment 1
class ServiceB final {
public:
static constexpr char const* service_full_name() {
return "grpc.testing.ServiceB";
}
class StubInterface {
public:
virtual ~StubInterface() {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment