grpc-gateway icon indicating copy to clipboard operation
grpc-gateway copied to clipboard

Is it possible to specify multiple fields in `HttpRule.body`?

Open inliquid opened this issue 1 year ago • 3 comments

📚 Documentation

According to documentation (which I found) body parameter is:

The name of the request field whose value is mapped to the HTTP request body, or * for mapping all request fields not captured by the path pattern to the HTTP body, or omitted for not having any HTTP request body.

https://cloud.google.com/endpoints/docs/grpc-service-config/reference/rpc/google.api#google.api.HttpRule.FIELDS.string.google.api.HttpRule.body

It is not clear whether I can or can't select multiple fields for body (so that the others can be passed through query params). I would like to have such ability.

inliquid avatar Nov 29 '22 12:11 inliquid

I believe this is only possible by exclusion, i.e., by specifying all the variables you don't want in the body in the path. As long as you use body: "*", any fields not in the path will be expected in the body, not the query parameters. Specifying that you want some set of variables in the body and some variables in query parameters is not possible with more than 1 field in the body, AFAIK. Hope that helps!

johanbrandhorst avatar Dec 04 '22 01:12 johanbrandhorst

Thanks, does it make sense to put a clarification in the docs?

inliquid avatar Dec 04 '22 13:12 inliquid

The documentation that you found (and indeed, the actual source of truth), is not controlled by us, so we can't fix that part of the documentation. We do have a docs page, do you think there's any place on there where it would make sense to clarify this?

johanbrandhorst avatar Dec 04 '22 17:12 johanbrandhorst