Add documentation for the enum descriptions#633
Conversation
Summary of ChangesHello, 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 introduces new documentation for a feature in Highlights
Changelog
Activity
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.
Code Review
This pull request adds documentation for the new enum descriptions feature. The documentation is clear and covers the main aspects of usage. I've found a small inconsistency in one of the JSON examples and have a suggestion to improve the C++ code example to promote better maintenance practices. Overall, a good addition to the documentation.
| default: | ||
| return ""; | ||
| } |
There was a problem hiding this comment.
While using a default case is safe, it might be worth adding a note to the documentation about an alternative approach. By omitting the default case and explicitly handling all enum values, developers can leverage compiler warnings (e.g., -Wswitch on GCC/Clang) to detect unhandled enum values when the enum is updated. This helps ensure that descriptions are always provided for all values and is a common C++ best practice.
| { | ||
| "type": "object", | ||
| "properties": { | ||
| "size": { | ||
| "type": "string", | ||
| "enum": ["small", "medium", "large"] | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
The generated JSON schema in this example is inconsistent with the one in the 'Basic usage' section. It's missing the top-level schema structure ($schema, $ref, $defs) and the required property. To avoid confusion and maintain consistency, this example should also show a complete and valid JSON schema for the Config struct.
| { | |
| "type": "object", | |
| "properties": { | |
| "size": { | |
| "type": "string", | |
| "enum": ["small", "medium", "large"] | |
| } | |
| } | |
| } | |
| { | |
| "$schema": "https://json-schema.org/draft/2020-12/schema", | |
| "$ref": "#/$defs/Config", | |
| "$defs": { | |
| "Config": { | |
| "type": "object", | |
| "properties": { | |
| "size": { | |
| "type": "string", | |
| "enum": ["small", "medium", "large"] | |
| } | |
| }, | |
| "required": ["size"] | |
| } | |
| } | |
| } |
No description provided.