Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(proto): expose Package for pb Service Descriptor #83

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

DMwangnima
Copy link
Contributor

What type of PR is this?

feat

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

feat(proto): 让 pb 服务描述符暴露 Package

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
Take the following pb idl as an example:

syntax = "proto3";

package a.b.c;

option go_package = "grpc_official_demo/official";

message Request {
  string message = 1;
}

message Response {
  string message = 1;
}

service GRPCEchoService {
  rpc EchoUnary(Request) returns (Response) {}
  rpc EchoClient(stream Request) returns (Response) {}
  rpc EchoServer(Request) returns (stream Response) {}
  rpc EchoBidi(stream Request) returns (stream Response) {}
}

To request EchoServer, for a standard gRPC request, “:path” is filled with “/a.b.c.GRPCEchoService/EchoServer” Where “a.b.c” is the Package of the pb idl.
The current Kitex Json2Pb Streaming generic call using dynamicgo does not resolve to the pb idl's Package, the ":path" is filled with "/GRPCEchoService/EchoServer", and there is problem to access to other official gRPC libraries such as gRPC-python.
zh(optional):
以下列 pb idl 为例:

syntax = "proto3";

package a.b.c;

option go_package = "grpc_official_demo/official";

message Request {
  string message = 1;
}

message Response {
  string message = 1;
}

service GRPCEchoService {
  rpc EchoUnary(Request) returns (Response) {}
  rpc EchoClient(stream Request) returns (Response) {}
  rpc EchoServer(Request) returns (stream Response) {}
  rpc EchoBidi(stream Request) returns (stream Response) {}
}

要请求 EchoServer,对于一个标准的 gRPC 请求,":path" 填入的值为 "/a.b.c.GRPCEchoService/EchoServer"。
其中 "a.b.c" 为 pb idl 的 Package。
当前 Kitex Json2Pb Streaming 泛化调用利用 dynamicgo 无法解析到 pb idl 的 Package,":path" 填入的值为 "/GRPCEchoService/EchoServer",无法访问 gRPC-python 等其他官方 gRPC 库。

(Optional) Which issue(s) this PR fixes:

(optional) The PR that updates user documentation:

conv/j2p/conv_test.go Outdated Show resolved Hide resolved
@DMwangnima DMwangnima force-pushed the feat/pb_parse_package branch from 87987cc to 0bf41c5 Compare December 20, 2024 07:35
@AsterDY AsterDY merged commit 55704ea into cloudwego:main Dec 20, 2024
8 checks passed
@DMwangnima DMwangnima deleted the feat/pb_parse_package branch December 20, 2024 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants