-
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
Support for path collapsing for embedded structs? #187
Comments
After looking at this more, I suspect it may be not possible because we've used a custom message ExampleOptions {
bool Foo = 4;
string Bar = 5;
string Baz = 6;
ListOptions ListOptions = 3 [(gogoproto.nullable) = false, (gogoproto.embed) = true, (gogoproto.jsontag) = ""];
}
// ListOptions specifies general pagination options for fetching a list of results.
message ListOptions {
int32 PerPage = 1 [(gogoproto.moretags) = "url:\",omitempty\""];
int32 Page = 2 [(gogoproto.moretags) = "url:\",omitempty\""];
} But curious to hear your thoughts on this. |
I am trying to keep grpc-gateway as consistent to Google's internal similar solution as possible. |
I am in agreement and not breaking that spec is important to me too. I am primarily asking if there's a spec-complaint way to achieve this ability to shorten some paths. It's reasonable if that turns out to be out of scope and not possible. |
@shurcooL Sorry for being late. I thought about that and I concluded that nothing technically prevents us from implementing that. However, I could change my mind if I had more concrete use cases. |
No problem, thanks for considering this issue. I created it because I wanted us to think through this potentially unwanted scenario and see if there's a good solution to it. I agree it's helpful to not diverge too much from the underlying After thinking about this in the back of my mind for many days, I still haven't come up with an idea that I would consider viable. So, I'm okay to close this feature request issue as "no viable solution" that is in the spirit of this library. I don't want to try to provide convincing use cases because I don't think there's any that would warrant straying away from the spec. Is it all right if I close the issue then? |
Yes. I'll close this issue. |
This is a question or potential feature request. Let me describe the situation.
Suppose you have a gRPC method that accepts a
ExampleOptions
type as the parameter:(Notice that
ListOptions
is embedded intoExampleOptions
.)grpc-protobuf supports method parameters in query string, so it's possible to define this in a .proto file:
And then do an HTTP GET request to:
But I'm wondering if it'd be possible to do this instead:
Just like in Go, when a struct is embedded, you can access it via the short form of
opt.Page
instead ofopt.ListOptions.Page
. Would the same be possible for grpc-gateway parameter names?The text was updated successfully, but these errors were encountered: