Skip to content

fix(workflow): dump validated schemas in JSON mode - #6750

Closed
a2105z wants to merge 1 commit into
google:mainfrom
a2105z:fix/output-schema-json-mode
Closed

a2105z wants to merge 1 commit into
google:mainfrom
a2105z:fix/output-schema-json-mode

Conversation

@a2105z

@a2105z a2105z commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Use model_dump(mode="json") when converting validated node schema results to dicts so when_used="json" serializers run and values like Decimal / datetime / non-str Enum stay JSON-serializable
  • Align BaseNode._to_serializable, validate_node_data, validate_schema, and resume-response dumping with the documented Event.output contract
  • Add regression coverage for the reported Decimal case plus datetime/Enum

Fixes #6747

Test plan

Python-mode model_dump left Decimal/datetime/Enum values that break
Event.output JSON serialization despite docs promising JSON-safe dicts.
copybara-service Bot pushed a commit that referenced this pull request Oct 1, 2026
Merge #6750

BREAKING CHANGE: Coerces validated schema inputs and outputs (Decimal, datetime, UUID, Enum) to JSON primitives (str, int) via mode='json'. This affects in-memory node outputs as well as llm_agent output_key state and agent_tool results (bare Decimal dumps to str), as well as node inputs when a dict input_schema is used (such as with parameter_binding='node_input'). Additionally, validating against a dict or types.Schema now raises a hard failure (PydanticSerializationError) on values that Pydantic cannot coerce, where un-coercible values passed through before.

Fixes #6747

PiperOrigin-RevId: 991903366
@adk-bot

adk-bot commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Thank you @a2105z for your contribution! 🎉

Your changes have been successfully imported and merged via Copybara in commit d1e61e5.

Closing this PR as the changes are now in the main branch.

@adk-bot adk-bot added the merged [Status] This PR is merged label Oct 1, 2026
@adk-bot adk-bot closed this Oct 1, 2026
copybara-service Bot pushed a commit that referenced this pull request Oct 1, 2026
Merge #6750

BREAKING CHANGE: Coerces validated schema inputs and outputs (Decimal, datetime, UUID, Enum) to JSON primitives (str, int) via mode='json'. This affects in-memory node outputs as well as llm_agent output_key state and agent_tool results (bare Decimal dumps to str), as well as node inputs when a dict input_schema is used (such as with parameter_binding='node_input'). Additionally, validating against a dict or types.Schema now raises a hard failure (PydanticSerializationError) on values that Pydantic cannot coerce, where un-coercible values passed through before.

Fixes #6747

PiperOrigin-RevId: 991959930
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged [Status] This PR is merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

output_schema validation dumps in pydantic python mode, so the node result is not JSON-serializable

3 participants