We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Kratos 生成的 Go 代码和 grpc-gateway 不一致
之前在 #1192 提过支持 URL 参数含有 , 分割的多个参数,后来发现 grpc-gateway 已经支持了 grpc-ecosystem/grpc-gateway#742
,
写了个简单的 demo 在这里 ringsaturn/grpc-gateway-demo@3e31c7f 是能正常生成 Go 代码并用 runtime.Float32Slice(val, ",") 解析参数
runtime.Float32Slice(val, ",")
func request_Greeter_GetName_0(ctx context.Context, marshaler runtime.Marshaler, client GreeterClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetRequest var metadata runtime.ServerMetadata var ( val string ok bool err error _ = err ) val, ok = pathParams["coordinates"] if !ok { return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "coordinates") } protoReq.Coordinates, err = runtime.Float32Slice(val, ",") if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "coordinates", err) } msg, err := client.GetName(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err }
但是 Kratos 生成的代码没有用这个方法解析参数 ringsaturn/kratos-demo@dfcbb4e
两个 demo 仓库都放在 GitHub 了
kratos -v
go version
cat /etc/os-release
The text was updated successfully, but these errors were encountered:
@longXboy 虾哥帮忙看下吧
Sorry, something went wrong.
是说要支持repeated字段吗?
对
是说要支持repeated字段吗? 对
好,我们评估一下支持的复杂度
No branches or pull requests
What happened:
Kratos 生成的 Go 代码和 grpc-gateway 不一致
What you expected to happen:
之前在 #1192 提过支持 URL 参数含有
,
分割的多个参数,后来发现 grpc-gateway 已经支持了 grpc-ecosystem/grpc-gateway#742写了个简单的 demo 在这里 ringsaturn/grpc-gateway-demo@3e31c7f 是能正常生成 Go 代码并用
runtime.Float32Slice(val, ",")
解析参数但是 Kratos 生成的代码没有用这个方法解析参数 ringsaturn/kratos-demo@dfcbb4e
How to reproduce it (as minimally and precisely as possible):
两个 demo 仓库都放在 GitHub 了
Anything else we need to know?:
Environment:
kratos -v
): kratos version v2.0.0go version
): go version go1.14 darwin/amd64cat /etc/os-release
): macOS 11.4The text was updated successfully, but these errors were encountered: