From f085aba302001986fd04219d2843f659f73c4031 Mon Sep 17 00:00:00 2001 From: Tyler Hawkes Date: Mon, 29 Jun 2020 09:24:47 -0600 Subject: [PATCH] fix(build): Allow empty packages (#382) Fixes #381 --- tonic-build/src/client.rs | 7 ++++++- tonic-build/src/server.rs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tonic-build/src/client.rs b/tonic-build/src/client.rs index b2277bb59..db8eaa32c 100644 --- a/tonic-build/src/client.rs +++ b/tonic-build/src/client.rs @@ -92,8 +92,13 @@ fn generate_methods(service: &T, proto_path: &str) -> TokenStream { for method in service.methods() { let path = format!( - "/{}.{}/{}", + "/{}{}{}/{}", service.package(), + if service.package().is_empty() { + "" + } else { + "." + }, service.identifier(), method.identifier() ); diff --git a/tonic-build/src/server.rs b/tonic-build/src/server.rs index e1e52cd60..91d8f66de 100644 --- a/tonic-build/src/server.rs +++ b/tonic-build/src/server.rs @@ -216,8 +216,13 @@ fn generate_methods(service: &T, proto_path: &str) -> TokenStream { for method in service.methods() { let path = format!( - "/{}.{}/{}", + "/{}{}{}/{}", service.package(), + if service.package().is_empty() { + "" + } else { + "." + }, service.identifier(), method.identifier() );