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

kitex工具如何支持protobuf struct #1647

Open
hmldd opened this issue Dec 20, 2024 · 3 comments
Open

kitex工具如何支持protobuf struct #1647

hmldd opened this issue Dec 20, 2024 · 3 comments

Comments

@hmldd
Copy link

hmldd commented Dec 20, 2024

Is your feature request related to a problem? Please describe.
代码中引起protobuf的struct结构,kitex命令行生成文件时报错。
kitex_gen/userve/userve.pb.fast.go:444:49: cannot use &v (value of type *structpb.Struct) as fastpb.Reader value in argument to fastpb.ReadMessage: *structpb.Struct does not implement fastpb.Reader (missing method FastRead)
kitex_gen/userve/userve.pb.fast.go:790:62: cannot use v (variable of type *structpb.Struct) as fastpb.Writer value in argument to fastpb.WriteMessage: *structpb.Struct does not implement fastpb.Writer (missing method FastWrite)
kitex_gen/userve/userve.pb.fast.go:1106:42: cannot use v (variable of type *structpb.Struct) as fastpb.Sizer value in argument to fastpb.SizeMessage: *structpb.Struct does not implement fastpb.Sizer (missing method Size)
kitex_gen/userve/userve.pb.fast.go:1215:18: undefined: structpb.File_api_struct_proto

proto用法:
...
import "google/protobuf/struct.proto";
message GetUserDataResponse {
map<string, google.protobuf.Struct> data = 1;
}
...

Describe the solution you'd like
kitex工具支持import "google/protobuf/struct.proto"应用protobuf Struct结构

Describe alternatives you've considered

Additional context

protobuf struct文档:
https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/struct.proto

@ppzqh
Copy link
Contributor

ppzqh commented Dec 23, 2024

fastPB现在生成的代码不支持 import google/protobuf 下的类型。生成命令里,多加一个 -no-fast-api 参数,应该就可以了

@hmldd
Copy link
Author

hmldd commented Dec 23, 2024

-no-fast-api 不影响grpc的数据传输吧?

@ppzqh
Copy link
Contributor

ppzqh commented Dec 23, 2024

不影响

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants