Skip to content

fix(compat): allow DataPart.data to accept Any to align with spec#823

Closed
Akshat8510 wants to merge 1 commit intoa2aproject:1.0-devfrom
Akshat8510:fix/datapart-type-hint
Closed

fix(compat): allow DataPart.data to accept Any to align with spec#823
Akshat8510 wants to merge 1 commit intoa2aproject:1.0-devfrom
Akshat8510:fix/datapart-type-hint

Conversation

@Akshat8510
Copy link

Closes #714

Changes:

  • Updated DataPart.data type hint from dict[str, Any] to Any in src/a2a/compat/v0_3/types.py.

Context:
Following the 1.0-dev refactor, the DataPart class now resides in the compat/v0_3 layer. This change ensures that the compatibility layer aligns with the A2A specification (where data can be an object, array, string, etc.).

I verified that the new 1.0 types (generated from Protobuf) use the Part message, which already correctly handles these types.

Signed-off-by: Akshat Kumar <akshat230405@gmail.com>
@Akshat8510 Akshat8510 requested a review from a team as a code owner March 13, 2026 03:19
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a compatibility issue by broadening the accepted data type for the DataPart.data field. By changing the type hint to Any, the system can now correctly handle various data structures as defined by the A2A specification, ensuring seamless integration with the new 1.0-dev refactor and its Part message.

Highlights

  • Type Hint Update: Updated the type hint for DataPart.data from dict[str, Any] to Any in src/a2a/compat/v0_3/types.py to align with the A2A specification's flexibility for data types.
Changelog
  • src/a2a/compat/v0_3/types.py
    • Changed the type hint for DataPart.data to Any to support diverse data types as per the A2A specification.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Akshat8510
Copy link
Author

@gemini-code-assist/gemini review

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

This pull request updates the type hint for DataPart.data in src/a2a/compat/v0_3/types.py from dict[str, Any] to Any. As described, this change aligns the type with the A2A specification, which permits any valid JSON type for this field, not just objects. The change is a targeted modification to the type hint. I have reviewed the changes and have no further comments.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

This pull request updates the type hint for DataPart.data in the v0.3 compatibility layer from dict[str, Any] to Any. This change correctly aligns the type definition with the A2A specification, which allows the data field to be any valid JSON value, not just an object. The change is accurate and appropriate.

@ishymko
Copy link
Member

ishymko commented Mar 13, 2026

Hey @Akshat8510, thanks for taking a look, please see #714 (comment), this is working as intended.

@ishymko ishymko closed this Mar 13, 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.

2 participants