-
Notifications
You must be signed in to change notification settings - Fork 24
fix: Escape "Google" as a keyword #930
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
fix: Escape "Google" as a keyword #930
Conversation
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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.
e09bac7 to
38f2fb3
Compare
|
Converted to draft until chekcs are green, etc. |
cb785b7 to
0afc0d2
Compare
| // 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)) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // 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)) |
There was a problem hiding this comment.
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".
0cdf2d5 to
9c28ada
Compare
amanda-tarafa
left a comment
There was a problem hiding this 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.
9c28ada to
cd82bd8
Compare

Treat google as a keyword in terms of escaping.
Validation
Google.Apis.Aiplatform.v1client successfully executed aListModelsAPI call againstprojects/robertvoinescu-testing/locations/global.