Skip to content

Raw paginated method samples always assume that paginated field is called responses #880

@vam-google

Description

@vam-google

For each paginated method GAPIC clients also provide a raw version of it, without GAPIC pagination machinery enabled. The inline code samples for such methods always assume that there is a repeated field named "responses`, while the repeated field may be given any field (paginated response must have only one repeated field by convention, but that repeated field may have any name).

For example in vision/v1/ProductSearchClient.java#L675:

Instad of:

for (ProductSet element : response.getResponsesList()) {

It should be:

for (ProductSet element : response.getProductSetsList()) {

Because the corresponding paginated field in the proto definition is called product_sets

Currently the samples assume response.getResponsesList() for all gapics regardless of how the field is actually called in each specific API.

The same stuff but in gapic-generator-java goldens:
EchoClient.golden#L526
echo.proto#L237

Notice, in gapic-generator-java tests the paginated field is actually called responses, coincidentally leading to a correct result (hard-coded value matches actual value).

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.samplesIssues that are directly related to samples.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions