X Tutup
Skip to content

Fix: Update pagination token key to 'nextPageToken' in ListTenantsResponse#1194

Open
siddharthmohan619-eng wants to merge 1 commit intofirebase:mainfrom
siddharthmohan619-eng:fix-tenant-pagination-1192
Open

Fix: Update pagination token key to 'nextPageToken' in ListTenantsResponse#1194
siddharthmohan619-eng wants to merge 1 commit intofirebase:mainfrom
siddharthmohan619-eng:fix-tenant-pagination-1192

Conversation

@siddharthmohan619-eng
Copy link

description
This PR fixes an issue where fetching more than 100 tenants via listTenants() fails to return the pagination token, breaking the pagination loop for developers.
The underlying GCP Identity Platform API returns the pagination token under the JSON key "nextPageToken", but the SDK was incorrectly mapping it to "pageToken". This caused the parsed token to always evaluate to null.

Related Issue
Fixes #1192

Changes Made
ListTenantsResponse.java: Updated the @key annotation for the pagination token from "pageToken" to "nextPageToken".
ListTenantsResponseTest.java: Updated the mock JSON payload in testDeserialization to use the correct "nextPageToken" key to reflect real-world API behavior.
Testing
Ran mvn validate to ensure Checkstyle compliance.
Ran mvn test to verify all unit tests pass successfully with the updated mock data. adda a human touch]

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical pagination issue in the listTenants() method, which previously prevented users from fetching more than 100 tenants. The fix involves correcting a misaligned key mapping for the pagination token, ensuring that the SDK now correctly processes the nextPageToken from the API response, thereby restoring proper pagination functionality.

Highlights

  • Pagination Token Key Update: The @Key annotation for the pagination token in ListTenantsResponse.java was updated from "pageToken" to "nextPageToken" to correctly map the token returned by the GCP Identity Platform API.
  • Test Case Alignment: The mock JSON payload in ListTenantsResponseTest.java was updated to use "nextPageToken" to reflect the real-world API behavior and ensure accurate testing of the deserialization process.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/main/java/com/google/firebase/auth/internal/ListTenantsResponse.java
    • Updated the @Key annotation for the pageToken field from "pageToken" to "nextPageToken".
  • src/test/java/com/google/firebase/auth/internal/ListTenantsResponseTest.java
    • Modified the mock JSON payload in testDeserialization to use "nextPageToken" instead of "pageToken".
Activity
  • The author ran mvn validate to ensure Checkstyle compliance.
  • The author ran mvn test to verify all unit tests passed successfully with the updated mock data.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes a pagination issue where listTenants() failed to return a pagination token. The fix involves updating the JSON key mapping in ListTenantsResponse from pageToken to nextPageToken to match the API response, and updating the corresponding test. The change is effective and addresses the described issue. I have added one minor suggestion to improve code consistency and maintainability.


@Key("pageToken")
@Key("nextPageToken")
private String pageToken;

Choose a reason for hiding this comment

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

medium

The field name pageToken is now inconsistent with the JSON key nextPageToken specified in the @Key annotation on line 33. For better code clarity and maintainability, consider renaming this field to nextPageToken. This would likely require updating the constructor and the getPageToken() method as well. If this refactoring is out of scope for this PR, it could be addressed in a follow-up.

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.

Auth list tenants is not pageable

1 participant

X Tutup