-
Notifications
You must be signed in to change notification settings - Fork 46
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
Repeated fields in parameter are set as a single string v.s. a slice of string (incompatible with grpc-gateway
)
#1160
Comments
grpc-gateway
)
Thanks for the bug report. I think you are right and your suggested fix to the generated code seems like it would work. I will see about fixing this soon. |
This is just a note: gapic-generator-go/internal/gengapic/genrest.go Lines 452 to 454 in 1f99ec7
The |
Relevant gRPC-HTTP Transcoding semantics that the generator is currently violating are documented in the following comments on the
This is the standard for the behavior that @HuairuoYang sees in |
Thank you @noahdietz ! Could I ask when would this be fixed and which will it be included in the next release (when)? |
Just opened a PR :) If merged today, I can release today. Otherwise, it will go out on Monday (we try not to release on Friday). |
Impressive! Thanks! |
Release to come on Monday @HuairuoYang |
Should be available in |
Verified that it works! Thanks again for fast response and execution of the team! @noahdietz |
I am using this client generator to generate clients that can talk to my server via REST/GRPC in an easy approach. And I am using
grpc-gateway
for routing the HTTP/REST requests to GRPC. I thought both this andgrpc-gateway
are popular tools and they all generate code from protobuf so that they should be compatible with each other.However I noticed that the repeated field parameter didn't work well.
Could you please help to check if this is a bug/issue, or if this is a feature that is nice to have?
I think people would be more than happy if the generated REST Clients can be directly used against
grpc-gateway
!Thanks!
Environment details
Steps to reproduce
My proto is similar to this:
So I can send a request with Types = [0, 1].
And in the generated REST client's
List
method, theTypes
is set in this wayThis sets a single string
[0,1]
to the parametertypes
.Whereas in the server side,
grpc-gateway
receives the request and parses the parameter using this method: Parse, where the inputvalues
is therequest.Form
which contains the parameter k-v pair.And it will parse the above
types: "[0,1]"
tokey: types
,value: "[0,1]"
(Note, it is a string"[0,1]"
). And it will fail saying that[0,1]
is not a correct enum type.My solution is to adjust the above code in the generated REST clients:
to add multiple strings for the types and this will work perfectly with
grpc-gateway
.This will set the parameter fields with a slice of strings
0
,1
andgrpc-gateway
will parse and return correct values.The text was updated successfully, but these errors were encountered: