-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
does not parse query params of a DELETE HTTP rpc definition into swagger.json file
#559
Comments
@zwtj I've seen this behaviour with POST method which has query params. I think it is a bug in the code generator for the JSON Swagger spec which is output. |
I've also seen the issue with POST method. The query parameters are not generated in the swagger definition. For example, if I generate swagger definition for this example, I got the following (In theory I should see a and b).
|
Indeed, seems like |
@johanbrandhorst I don't think it's a regression. I'm not sure it ever worked. I'd have to gitbisect to understand better though. |
i've run into similar problem when transcoding a POST method where the query params are not parsed, should i create a separate issue? also, i would like to help, but need some pointer as to where might the problem be, i have simply tried to apply the same trick used for DELETE method for POST, but it didn't work |
@wotzhs I think the easiest thing would be to start with adding an example that reproduces the issue, e.g. add a method to |
@johanbrandhorst just checking with you if this is going into the right direction, i have tried to update the function in grpc-gateway/protoc-gen-swagger/genswagger/template.go so that the non path and body parameters will be added to query string for http POST method. i.e.: message BodyWithQueryString {
string someid = 1;
string somequery = 2;
string somevalue = 3;
Body data = 4;
}
message Body {
string body = 1 ;
}
service SomeService {
rpc SomeRPC(BodyWithQueryString) returns (google.protobuf.Empty) {
post: "/somepath/someprc/{somevalue}",
body: "data"
};
} and the generated
this change has however caused a lot of side effects, and failing multiple tests, while i can update the test cases so that they would pass, but i wonder if this is something the package authors would have wanted as well? -> #234 disclaimer: this is my very first endeavor to contributing to an opensource project, feedback are very much appreciated |
Great work so far @wotzhs, could you submit your changes in a pull request so we can review them? It sounds to me like you're doing the right thing :). |
@wotzhs Would love to see this land. Let me know how I can help 👍 |
@novabyte thank you for your offer to help 👍, this is taking a lot longer than i thought as i am quite stuck on the complexity of the non-primitive types such as the I have not yet taken the time to observe and understand how the above works currently in either the I have checked the google.api.http doc, there was no mention of whether the I suspect that i will have to look into the code generator to prevent all the fields of the |
Hi, just want to check if anyone has this sorted out yet? I'm still encountering the exact same problem. |
Doesn't seem like it's been fixed yet. What can I do to help you bring in a fix for this? |
I'm using protoc-gen-swagger-v1.16.0-linux-x86_64, I can see that the issue was fixed for post methods, but it still behaving on put methods. Any idea when everything will be fixed ? |
Hi,
I defined a proto file called
abc.proto
as follows:When I used
protoc -I . -I/usr/include -I $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --go_out=plugins=grpc:. --grpc-gateway_out=logtostderr=true:. --swagger_out=logtostderr=true:. ./abc.proto
to getabc.swagger.json
, I expected that theDelConfigsRequest
was parsed byprotoc-gen-swagger
to generate query parameters for thedelete
method. In fact it's not parsed at all. Theabc.swagger.json
I got is the following:Is this an expected behavior to ignore the arguments of the
delete
method?I'm using a Mac with macOS Sierra, go v1.9.3 darwin/amd64, and protoc 3.5.0.
The text was updated successfully, but these errors were encountered: