diff --git a/codegen/src/generator.rs b/codegen/src/generator.rs index 8d28c0f..764bc12 100644 --- a/codegen/src/generator.rs +++ b/codegen/src/generator.rs @@ -754,22 +754,23 @@ fn write_service(svc_proto: &ServiceDescriptorProto, package: &str, output: &mut for method_res in svc_proto.method() { let (method_data, _) = method_res.expect("Failed to iterate method"); let method_proto = MethodDescriptorProto::new(method_data).expect("Failed to parse MethodDescriptorProto"); - let method_name = to_snake_case(method_proto.name().unwrap()); + let original_method_name = method_proto.name().unwrap().to_string(); + let method_name = to_snake_case(&original_method_name); let input_full_name = method_proto.input_type().unwrap(); let input_type = input_full_name.split('.').last().unwrap(); let input_owned = format!("Owned{}", input_type); let server_streaming = method_proto.server_streaming().unwrap_or(false); - methods.push((method_name, input_owned, server_streaming)); + methods.push((original_method_name, method_name, input_owned, server_streaming)); } - for (method_name, input_owned, server_streaming) in methods { + for (original_method_name, method_name, input_owned, server_streaming) in methods { if server_streaming { // For streaming RPCs, we don't implement the server logic yet. // We just make it compile by returning a "not implemented" response. let full_path = if package.is_empty() { - format!("/{}/{}", svc_proto.name().unwrap(), method_name) + format!("/{}/{}", svc_proto.name().unwrap(), original_method_name) } else { - format!("/{}.{}/{}", package, svc_proto.name().unwrap(), method_name) + format!("/{}.{}/{}", package, svc_proto.name().unwrap(), original_method_name) }; output.push_str(&format!(" if path == \"{}\" {{\n", full_path)); output.push_str(" let res_body = BoxBody::new(StatusBody::new(Some(Bytes::from_static(&[0, 0, 0, 0, 0])), 0));\n"); @@ -778,9 +779,9 @@ fn write_service(svc_proto: &ServiceDescriptorProto, package: &str, output: &mut continue; } let full_path = if package.is_empty() { - format!("/{}/{}", svc_proto.name().unwrap(), method_name) + format!("/{}/{}", svc_proto.name().unwrap(), original_method_name) } else { - format!("/{}.{}/{}", package, svc_proto.name().unwrap(), method_name) + format!("/{}.{}/{}", package, svc_proto.name().unwrap(), original_method_name) }; output.push_str(&format!(" if path == \"{}\" {{\n", full_path)); output.push_str(&format!(" let request_msg = match {}::decode(payload) {{\n", input_owned)); diff --git a/roto-tonic/src/generated/interop.rs b/roto-tonic/src/generated/interop.rs index 54944a2..943e8ca 100644 --- a/roto-tonic/src/generated/interop.rs +++ b/roto-tonic/src/generated/interop.rs @@ -463,7 +463,6 @@ impl Service> for InteropServiceServer { let payload = bytes_vec.slice(5..); let mut routed = false; - if path == "/interop.InteropService/UnaryCall" { let request_msg = match OwnedUnaryRequest::decode(payload) { Ok(msg) => msg, @@ -495,7 +494,7 @@ impl Service> for InteropServiceServer { routed = true; return Ok(http::Response::builder().status(200).header("content-type", "application/grpc").body(res_body).unwrap()); } - if path == "/interop.InteropService/streaming_call" { + if path == "/interop.InteropService/StreamingCall" { let res_body = BoxBody::new(StatusBody::new(Some(Bytes::from_static(&[0, 0, 0, 0, 0])), 0)); return Ok(http::Response::builder().status(200).body(res_body).unwrap()); }