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

Swagger definitions don't handle parameters that are not explicitly required in the url #159

Closed
achew22 opened this issue May 17, 2016 · 7 comments

Comments

@achew22
Copy link
Collaborator

achew22 commented May 17, 2016

message Message {
  string message = 1;
}

message GetMessageRequest {
  message SubMessage {
    string subfield = 1;
  }
  string message_id = 1; // mapped to the URL
  int64 revision = 2;    // becomes a parameter
  SubMessage sub = 3;    // `sub.subfield` becomes a parameter
}

service Messaging {
  rpc GetMessage(GetMessageRequest) returns (Message) {
    option (google.api.http) = {
      get: "/v1/messages/{message_id}"
    };
  }
}

This should enable a HTTP JSON to RPC mapping as below:

HTTP RPC
GET /v1/messages/123456?revision=2&sub.subfield=foo GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))

Presently it does not work

@hasLeland
Copy link

I'd like to add my support for this. Right now no query parameters are added at all for the generated paths in any swagger spec. This makes most all swagger specs useless, unless you map every field in every message to path parameters, which is very dirty solution indeed.

@johanbrandhorst
Copy link
Collaborator

The workaround right now is to pretty much use POST for all your HTTP endpoints, as far as I can tell. I second the need for this fix.

@rgarcia
Copy link
Contributor

rgarcia commented Jul 22, 2016

Opened a PR that attempts to address this #199

@ambarc
Copy link

ambarc commented Sep 7, 2016

+1

daved pushed a commit to daved/grpc-gateway that referenced this issue Oct 5, 2016
@jhayotte
Copy link

jhayotte commented Dec 1, 2016

+1,
@johanbrandhorst your workaround removes the possibility to have a REST API, I don't see that as a solution.
This PR #159 matches our expectation... Please merge it,

We really need something like below working

service Messaging {
  rpc GetMessage(GetMessageRequest) returns (Message) {
    option (google.api.http) = {
      get: "/v1/messages?type={type_id}&limit={limit}"
    };
  }
}

t-yuki pushed a commit to t-yuki/grpc-gateway that referenced this issue Jan 12, 2017
@AlekSi
Copy link
Contributor

AlekSi commented Oct 4, 2017

I think that issue can be closed?

@achew22
Copy link
Collaborator Author

achew22 commented Oct 28, 2017

Yep, I think this can be closed. Thanks!

@achew22 achew22 closed this as completed Oct 28, 2017
adasari pushed a commit to adasari/grpc-gateway that referenced this issue Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants