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

protoc-gen-swagger does not parse query params of a PUT HTTP rpc definition into swagger.json file #2093

Closed
ghevge opened this issue Apr 16, 2021 · 4 comments
Labels

Comments

@ghevge
Copy link

ghevge commented Apr 16, 2021

Hi,
If I try to define a query param on a PUT method as follows, the protoc-gen-swagger will not generate the swagger code related to the query param

syntax="proto3";

import "google/api/annotations.proto";
import "google/protobuf/empty.proto";

service ABC {

    rpc PutConfigs(PutConfigsRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
            put: "/api/v1/abc"
        };
    }
}

message PutConfigsRequest {
    int32 whatever = 1;
}

There was a similar problem reported on DELTE and POST methods (#559), which was fixed(I can confirm the fix for POST at least), but it seems PUT still has the issue

I am using protoc-gen-swagger-v1.16.0-linux-x86_64 to generate the swagger code.

Thanks

@ghevge
Copy link
Author

ghevge commented Apr 16, 2021

Some more details: I just realized that the issue only behaves if a body is not defined. I can see the same behavior on POST methods too. If I define a body, the query params are being defined in the swagger file.

@johanbrandhorst
Copy link
Collaborator

Hm, that definitely sounds wrong, it should be adding the parameters to the query parameters regardless of whether a body is specified or not. Do you have a failing test you could contribute? Similar to how fixing #559 started by adding a failing test: 8e387f7#diff-0330d83e3109c5c0a8cb78a2a980db731e973c738da7851d34a88e00244a4b5eR1696.

@ghevge
Copy link
Author

ghevge commented Apr 20, 2021

I would love too, but I don't have much go experience. And to set up and ramp up on the project it will take me some time, which I don't have at this moment.

@stale
Copy link

stale bot commented Jun 20, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 20, 2021
@stale stale bot closed this as completed Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants