From 34680a41039a9e108d927b6d8d6647277589c912 Mon Sep 17 00:00:00 2001 From: yifei Date: Thu, 28 Jul 2022 16:35:40 +0800 Subject: [PATCH] fix: set client and server streaming --- protobuf-parse/src/pure/convert/mod.rs | 8 ++++++++ .../src/v2/test_stream_pb.proto | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 test-crates/protobuf-codegen-protoc-test/src/v2/test_stream_pb.proto diff --git a/protobuf-parse/src/pure/convert/mod.rs b/protobuf-parse/src/pure/convert/mod.rs index 3bb63f2f2..a18b5e203 100644 --- a/protobuf-parse/src/pure/convert/mod.rs +++ b/protobuf-parse/src/pure/convert/mod.rs @@ -341,6 +341,14 @@ impl<'a> Resolver<'a> { .full_name .to_string(), ); + + if input.client_streaming { + output.set_client_streaming(input.client_streaming); + } + + if input.server_streaming { + output.set_server_streaming(input.server_streaming); + } Ok(output) } diff --git a/test-crates/protobuf-codegen-protoc-test/src/v2/test_stream_pb.proto b/test-crates/protobuf-codegen-protoc-test/src/v2/test_stream_pb.proto new file mode 100644 index 000000000..58737a585 --- /dev/null +++ b/test-crates/protobuf-codegen-protoc-test/src/v2/test_stream_pb.proto @@ -0,0 +1,18 @@ +syntax = "proto2"; + + +message Req { + required int32 a = 1; + repeated string b = 2; +} + +message Resp { + required int32 status = 1; +} + +service TestService { + rpc test_client_streaming(stream Req) returns (Resp); + rpc test_server_streaming(Req) returns (stream Resp); + rpc test_bi_streaming(stream Req) returns (stream Resp); +} +