-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
protoc-gen-swagger throws the error: Any JSON doesn't have '@type' #771
Comments
Curious, this definitely should be working, what does the JSON that it's trying to unmarshal look like? |
The struct of TestRequest is like below one, it is auto-generated. type TestRequest struct { |
What does the JSON input look like? |
Pass below through request' body, @johanbrandhorst } |
Yeah so you haven't specified the type URL in the JSON input. Please see documentation for the |
Sorry, I didn't find any official example from documentation, could you please supply one for me to refer to? thx @johanbrandhorst |
thx |
I defined a message which includes the 'google.protobuf.Any' type
message TestRequest {
int64 id = 1;
google.protobuf.Any items = 2;
}
and generate the related pb.gw.go file, and when to execute below auto-gen code, it failed with the error: Any JSON doesn't have '@type'
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
The text was updated successfully, but these errors were encountered: