Skip to content

fix(firebase_ai): Rename groundingSupport to groundingSupports#17961

Merged
dlarocque merged 3 commits into
mainfrom
dl/groundingsupports
Jan 21, 2026
Merged

fix(firebase_ai): Rename groundingSupport to groundingSupports#17961
dlarocque merged 3 commits into
mainfrom
dl/groundingsupports

Conversation

@dlarocque

@dlarocque dlarocque commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

We currently parse for a groundingSupport field, when it should be groundingSupports. This fixes an issue where groundingSupports are not parsed in responses or present in the API, and cannot be retrieved by users.

Fixes b/477107542

We currently parse for a `groundingSupport` field, when it should be
`groundingSupports`. This fixes an issue where groundingSupports are not
parse in responses, and cannot be retrieved by users.
@dlarocque dlarocque requested a review from cynthiajoan January 20, 2026 15:14
/// Each object details how specific segments of the
/// model's response are supported by the `groundingChunks`.
final List<GroundingSupport> groundingSupport;
final List<GroundingSupport> groundingSupports;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
final List<GroundingSupport> groundingSupports;
final List<GroundingSupport> groundingSupports;
/// A list of [GroundingSupport]s.
@Deprecated('Use groundingSupports instead')
List<GroundingSupport> get groundingSupport => groundingSupports;

@cynthiajoan cynthiajoan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

keep the current groundingSupport and mark it as deprecated

@cynthiajoan

Copy link
Copy Markdown
Collaborator

/gemini review

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

The pull request successfully renames the groundingSupport field to groundingSupports throughout the codebase, including the API definition, parsing logic, and all associated tests. This change correctly addresses the parsing issue and aligns the field name with the expected plural form. Additionally, the update in _parseGroundingSupport to use ?.cast<int>() enhances type safety and robustness when handling list casting.

segment: segment,
groundingChunkIndices:
(jsonObject['groundingChunkIndices'] as List<int>?) ?? []);
(jsonObject['groundingChunkIndices'] as List?)?.cast<int>() ?? []);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This change from as List<int>? to as List?)?.cast<int>() is a good improvement for type safety. It correctly handles cases where jsonObject['groundingChunkIndices'] might be a List<dynamic> or List<Object?> rather than directly List<int>, preventing potential runtime errors.

Suggested change
(jsonObject['groundingChunkIndices'] as List?)?.cast<int>() ?? []);
(jsonObject['groundingChunkIndices'] as List?)?.cast<int>() ?? []

@dlarocque dlarocque requested a review from cynthiajoan January 20, 2026 18:43
@dlarocque dlarocque merged commit cfb9098 into main Jan 21, 2026
26 of 31 checks passed
@dlarocque dlarocque deleted the dl/groundingsupports branch January 21, 2026 14:20
@firebase firebase locked and limited conversation to collaborators Jul 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants