Skip to content
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

feat: Add DIREGAPIC-specific pagination #767

Merged
merged 10 commits into from Jun 17, 2021

Conversation

vam-google
Copy link
Contributor

No description provided.

@vam-google vam-google requested review from miraleung and a team as code owners June 14, 2021 08:51
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jun 14, 2021
@codecov
Copy link

codecov bot commented Jun 14, 2021

Codecov Report

Merging #767 (7fd8258) into master (bc6eb85) will decrease coverage by 0.46%.
The diff coverage is 48.02%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #767      +/-   ##
==========================================
- Coverage   91.71%   91.25%   -0.47%     
==========================================
  Files         140      140              
  Lines       14795    14884      +89     
  Branches     1052     1061       +9     
==========================================
+ Hits        13569    13582      +13     
- Misses        942     1011      +69     
- Partials      284      291       +7     
Impacted Files Coverage Δ
.../com/google/api/generator/gapic/model/Message.java 62.16% <18.18%> (-18.61%) ⬇️
...ic/composer/defaultvalue/DefaultValueComposer.java 88.88% <42.85%> (-5.04%) ⬇️
...common/AbstractServiceClientTestClassComposer.java 84.26% <46.51%> (-3.75%) ⬇️
...mmon/AbstractServiceStubSettingsClassComposer.java 97.16% <50.00%> (-1.90%) ⬇️
...google/api/generator/gapic/protoparser/Parser.java 43.71% <60.00%> (+0.50%) ⬆️
...ic/composer/common/ServiceClientClassComposer.java 98.45% <100.00%> (ø)
...er/samplecode/ServiceClientSampleCodeComposer.java 99.28% <100.00%> (ø)
...a/com/google/api/generator/gapic/model/Method.java 91.66% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bc6eb85...7fd8258. Read the comment docs.

Copy link
Contributor

@miraleung miraleung left a comment

Choose a reason for hiding this comment

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

Could we base this PR on #765 if possible?

BUILD.bazel Outdated Show resolved Hide resolved
src/main/java/com/google/api/generator/Main.java Outdated Show resolved Hide resolved
List<String> fieldNames = new ArrayList<>();
fieldNames.add("page_size");
if (transport == Transport.REST) {
fieldNames.add("max_results");
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to do something to check that either max_results xor page_size are present, and not both?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. This logic explicitly prefers page_size over max_results if both are present, for safer backward compatibility (i.e. to not let DIREGAPIC-speficif logic mess with normal GAPICS, if somebody for whatever reason decides to add max_results field into a regular paginated gapic method.

Copy link
Contributor

Choose a reason for hiding this comment

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

SGTM, could we add a one-line comment to that effect, so that this behavior is clear to future readers who may be unfamiliar with this codebase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@vam-google
Copy link
Contributor Author

vam-google commented Jun 14, 2021

@miraleung There was a merge commit with conflicts in between, so rebasing was painful. I just cleaned up the other pr form this one manually, since it was easier (just 6 files with straightforward changes). I also migrated the relevant comments to the #765, please continue there.

return inputMessage.fieldMap().containsKey("page_size")
&& inputMessage.fieldMap().containsKey("page_token")
&& outputMessage.fieldMap().containsKey("next_page_token");
String pagedFieldName = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

As per the comment thread above, can we remove this null-assignment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a legit null assignment, as there is no else block. I.e. if there are not signs of field being paginated, null is a legit value, representing non-paginated case.

List<String> fieldNames = new ArrayList<>();
fieldNames.add("page_size");
if (transport == Transport.REST) {
fieldNames.add("max_results");
Copy link
Contributor

Choose a reason for hiding this comment

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

SGTM, could we add a one-line comment to that effect, so that this behavior is clear to future readers who may be unfamiliar with this codebase?

@vam-google
Copy link
Contributor Author

@miraleung PTAL

@vam-google vam-google merged commit 1294c29 into googleapis:master Jun 17, 2021
suztomo pushed a commit that referenced this pull request Mar 21, 2023
suztomo pushed a commit that referenced this pull request Mar 21, 2023
🤖 I have created a release *beep* *boop*
---


## [3.0.1](googleapis/java-shared-dependencies@v3.0.0...v3.0.1) (2022-08-02)


### Dependencies

* update dependency com.google.code.gson:gson to v2.9.1 ([#766](googleapis/java-shared-dependencies#766)) ([b0d531d](googleapis/java-shared-dependencies@b0d531d))
* update gax.version to v2.18.7 ([#767](googleapis/java-shared-dependencies#767)) ([02e98d5](googleapis/java-shared-dependencies@02e98d5))
* update google.core.version to v2.8.6 ([#770](googleapis/java-shared-dependencies#770)) ([3acea4b](googleapis/java-shared-dependencies@3acea4b))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
suztomo pushed a commit that referenced this pull request Mar 21, 2023
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [org.threeten:threetenbp](https://www.threeten.org/threetenbp) ([source](https://togithub.com/ThreeTen/threetenbp)) | `1.5.2` -> `1.6.0` | [![age](https://badges.renovateapi.com/packages/maven/org.threeten:threetenbp/1.6.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/org.threeten:threetenbp/1.6.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/org.threeten:threetenbp/1.6.0/compatibility-slim/1.5.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/org.threeten:threetenbp/1.6.0/confidence-slim/1.5.2)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>ThreeTen/threetenbp</summary>

### [`v1.6.0`](https://togithub.com/ThreeTen/threetenbp/releases/v1.6.0)

[Compare Source](https://togithub.com/ThreeTen/threetenbp/compare/v1.5.2...v1.6.0)

See the [change notes](https://www.threeten.org/threetenbp/changes-report.html) for more information.

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-core).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants