Skip to content

fix: forward convert_keys to nested values in convert_to_dict - #3471

Open
Sun-Wukhan wants to merge 3 commits into
googleapis:mainfrom
Sun-Wukhan:fix/convert-to-dict-nested-keys
Open

Sun-Wukhan wants to merge 3 commits into
googleapis:mainfrom
Sun-Wukhan:fix/convert-to-dict-nested-keys

Conversation

@Sun-Wukhan

Copy link
Copy Markdown

The dict branch of convert_to_dict called convert_to_dict(value) without forwarding convert_keys, so with convert_keys=True only the top level keys were converted and every nested dictionary kept snake case keys. The BaseModel and list branches already forward the flag. This forwards it in the dict branch too, and adds regression tests for a nested dict, a dict inside a list under a dict key, and the convert_keys=False default.

Fixes #3469

@rockadoba5-blip rockadoba5-blip left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

google/genai/_common.py

@rockadoba5-blip rockadoba5-blip left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This branch has not been deployed

No deployments
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.

convert_to_dict: convert_keys=True only converts the top level keys, because the dict branch does not pass convert_keys on to nested values

2 participants