Skip to content

Conversation

@robertvoinescu-work
Copy link
Contributor

Treat google as a keyword in terms of escaping.

Validation

  • The generated Google.Apis.Aiplatform.v1 client successfully executed a ListModels API call against
    projects/robertvoinescu-testing/locations/global.

@robertvoinescu-work robertvoinescu-work requested a review from a team as a code owner November 20, 2025 16:59
@gemini-code-assist
Copy link

Summary of Changes

Hello @robertvoinescu-work, 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 enhances the code generation process by explicitly reserving the terms "Google" and "google" as special identifiers. This ensures that the generated client libraries correctly handle these names, particularly in the context of top-level namespaces, thereby improving the robustness and correctness of the generated code.

Highlights

  • Keyword Definition: The terms "Google" and "google" have been added to the internal list of keywords within the code generator. Although not true C# keywords, they are now treated as such for escaping purposes, particularly when used as top-level namespace identifiers.
  • Code Generation Impact: This change ensures that generated code will properly escape these terms if they conflict with identifiers, preventing potential naming collisions or compilation issues in client libraries.
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 adds 'Google' and 'google' to the list of reserved keywords to ensure they are properly escaped, as they are used for the top-level namespace. The change is straightforward and effective. I have one suggestion to improve the clarity and consistency of the comments associated with these new keywords.

@amanda-tarafa
Copy link
Contributor

Converted to draft until chekcs are green, etc.

@robertvoinescu-work robertvoinescu-work force-pushed the reserved-words branch 3 times, most recently from cb785b7 to 0afc0d2 Compare November 20, 2025 18:19
// We don't really need to escape keywords given that we've upper-cased it,
// but this is what the Python code does.
if (addUnderscoresToEscape && Keywords.IsKeyword(upper.ToLowerInvariant()))
if (addUnderscoresToEscape && Keywords.IsKeyword(upper, ignoreCase: true))
Copy link
Contributor Author

@robertvoinescu-work robertvoinescu-work Nov 20, 2025

Choose a reason for hiding this comment

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

I believe the original intention here was to check if a keyword exists ignoring case, this was done using ToLowerInvariant(). This worked since the keywords where all lower case, this is no longer the case. So we just ignore case now.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'd prefer if we leave things as they were and we add a separate collection and method for case sensitive "reserved names", something like Keywords.IsReservedName(string name).

Look for instance at method Keywords.PrependAtIfKeyword, which may now result in some appearances of "Google" being turned into "@google".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done and verified the current changes are all that is needed to resolve the issue:
image

@robertvoinescu-work robertvoinescu-work marked this pull request as ready for review November 20, 2025 19:25
// We don't really need to escape keywords given that we've upper-cased it,
// but this is what the Python code does.
if (addUnderscoresToEscape && Keywords.IsKeyword(upper.ToLowerInvariant()))
if (addUnderscoresToEscape && Keywords.IsKeyword(upper, ignoreCase: true))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'd prefer if we leave things as they were and we add a separate collection and method for case sensitive "reserved names", something like Keywords.IsReservedName(string name).

Look for instance at method Keywords.PrependAtIfKeyword, which may now result in some appearances of "Google" being turned into "@google".

@robertvoinescu-work robertvoinescu-work force-pushed the reserved-words branch 3 times, most recently from 0cdf2d5 to 9c28ada Compare November 21, 2025 17:06
@robertvoinescu-work robertvoinescu-work changed the title fix: Escape "Google" as a keyword. fix: Escape "Google" as a keyword Nov 24, 2025
amanda-tarafa
amanda-tarafa previously approved these changes Nov 24, 2025
Copy link
Contributor

@amanda-tarafa amanda-tarafa left a comment

Choose a reason for hiding this comment

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

One tiny request, but LGTM.

@robertvoinescu-work robertvoinescu-work merged commit f0eca4d into googleapis:main Nov 24, 2025
4 of 5 checks passed
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