[AI] Nullable support in structured output and more integration tests#15752
Conversation
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. |
Generated by 🚫 Danger |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for Decimal and optional types within the structured output functionality. The core logic changes in FirebaseGenerable.swift, ModelOutput.swift, and FirebaseGenerableMacro.swift are well-implemented to handle nullable values and Decimal types correctly. A comprehensive set of integration tests has been added in SchemaTests.swift, which is great for ensuring the robustness of these new features. My review focuses on a couple of minor corrections in the new test code to fix a compilation issue and improve clarity.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for optional properties in structured output, a valuable enhancement for flexibility. The implementation across FirebaseGenerable, ModelOutput, and the FirebaseGenerableMacro appears correct and well-integrated. A significant portion of this PR is the addition of numerous integration tests, which greatly improve the test coverage for structured output generation. These tests cover a wide variety of types and constraints. My main feedback relates to improving the precision validation in tests involving Decimal types to make them more robust.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request effectively adds support for optional properties in structured output and significantly expands the integration test suite. The changes to FirebaseGenerable.swift, ModelOutput.swift, and FirebaseGenerableMacro.swift correctly handle optional types and null values from the model. The new integration tests in SchemaTests.swift are comprehensive, covering various data types, constraints, and error scenarios, which greatly improves confidence in the structured output feature. I have one suggestion to improve the maintainability of the new test code by reducing duplication, and a couple of minor formatting suggestions.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
andrewheard
left a comment
There was a problem hiding this comment.
Thanks, Paul! The null handling was a good catch.
I reverted the optional handling for Partial since it already appears to be fixed by my upstream changes for Optional. I added an optional middleName property in the unit test to verify that it still gets expanded properly without it.
I'll merge if CI still passes since your new integration tests check both nullable and optional handling.
FirebaseGenerable.swiftUpdates:ModelOutput.swiftUpdates: