Skip to content

Conversation

@Hectorhammett
Copy link
Contributor

@Hectorhammett Hectorhammett commented Jul 14, 2025

Edit the generation logic to pick the correct paginated results from a proto message.

b/427528266

@Hectorhammett Hectorhammett requested a review from a team as a code owner July 14, 2025 22:43
@Hectorhammett Hectorhammett requested a review from a team July 14, 2025 22:43
Copy link
Collaborator

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we don't want to make exceptions for these - the only reason we did that for UsableSubnetworksAggregatedList was because 1) it was a breaking change and we wanted it to unblock the release, and 2) it doesn't seem to obey any heuristic, so we needed an exception.

But implementing a better heuristic for determining which RPCs are paginated will result in a breaking change, as we are going to enforce a new heuristic which will correct the existing RPCs which we previously missed, as well as ensure we don't miss turning RPCs into paginated lists in the future.

The PHP Heuristic should look like this:

  • Check the exception dictionary. If the method is there as a key, use the value as the results field (you've done this already)
  • If there is exactly one map field, that field is the results field.
  • If there are no repeated fields there is no results field and we shall throw an error
  • If there is exactly one repeated field, that field is the results field.
  • If there is one repeated message field and any number of repeated primitives, we page on the message field

By implementing this, the above RPCs should be turned into paginated lists (without needing to add them to the exception dictionary)

@Hectorhammett Hectorhammett marked this pull request as draft July 22, 2025 23:31
@Hectorhammett Hectorhammett force-pushed the add-pagination-exceptions branch from 24263a9 to 3cf0926 Compare July 23, 2025 22:07
Copy link
Collaborator

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a few minor suggestions, but the logic here looks good! We just need to add some tests (either by updating compute_small.proto or by creating a new test like rest_only_pagination.proto).

@Hectorhammett Hectorhammett marked this pull request as ready for review July 31, 2025 20:41
@snippet-bot
Copy link

snippet-bot bot commented Jul 31, 2025

Here is the summary of changes.

You are about to add 4 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@Hectorhammett Hectorhammett force-pushed the add-pagination-exceptions branch from 614e5a1 to d5b096d Compare August 1, 2025 22:08
@bshaffer bshaffer merged commit 51b22ec into main Aug 1, 2025
6 checks passed
@bshaffer bshaffer deleted the add-pagination-exceptions branch August 1, 2025 22:25
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

Successfully merging this pull request may close these issues.

2 participants