Skip to content

fix(core): serialize nested BaseModel instances in to_json_attr - #81

Closed
huangjeff5 wants to merge 1 commit into
mainfrom
test/gemini-codereview-check
Closed

huangjeff5 wants to merge 1 commit into
mainfrom
test/gemini-codereview-check

Conversation

@huangjeff5

Copy link
Copy Markdown
Collaborator

Closes #80.

to_json_attr previously only checked isinstance(value, BaseModel) at the top level, falling back to str(value) when BaseModel instances were nested inside lists or dicts. Pass a default handler to json.dumps so nested BaseModel instances dump via model_dump(mode='json', by_alias=True, exclude_none=True).

@huangjeff5 huangjeff5 closed this Nov 10, 2026
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.

fix(core): serialize nested BaseModel instances in to_json_attr

1 participant