gapic-generator-java
gapic-generator-java copied to clipboard
Exclude fields from query params if the fields are already configured for path params or body.
We should exclude fields from query params if the fields are already configured for path params or body. See here for the detailed rules for mapping http annotation to body/path param/query param.
// ## Rules for HTTP mapping
//
// 1. Leaf request fields (recursive expansion nested messages in the request
// message) are classified into three categories:
// - Fields referred by the path template. They are passed via the URL path.
// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP
// request body.
// - All other fields are passed via the URL query parameters, and the
// parameter name is the field path in the request message. A repeated
// field can be represented as multiple query parameters under the same
// name.
// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields
// are passed via URL path and HTTP request body.
// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all
// fields are passed via URL path and URL query parameters.
The current logic does not exclude fields that are more than one level deep. We need to either traverse all the leaf level fields and exclude field in the generator or pass the excluded fields to gax-java.