Skip to content

fix!: use ProtoJSON for REST transport#292

Merged
guglielmo-san merged 45 commits intoa2aproject:mainfrom
guglielmo-san:fix_rest
Jan 13, 2026
Merged

fix!: use ProtoJSON for REST transport#292
guglielmo-san merged 45 commits intoa2aproject:mainfrom
guglielmo-san:fix_rest

Conversation

@guglielmo-san
Copy link
Copy Markdown
Member

@guglielmo-san guglielmo-san commented Jan 9, 2026

Description

This PR resolves an incompatibility in the payload shape between the REST Transport handlers and other A2A SDKs.

In this version, the transmitted payload now aligns with the field names and structure defined in the proto file. A new a2a.ts file has been introduced to represent the proto types, including their corresponding fromJson and toJson conversion functions.

Technically this is a breaking change, however current implementation isn't compatible with other official SDKs, so fixing in-place. Current situation with JSON format for HTTP+JSON is complicated as there is no explicit specification in 0.3, see here for more details.

Fixes #291 🦕

Release-As: 0.3.8

@guglielmo-san guglielmo-san changed the title !feat: Adapt Rest Transport to use the proto generated types feat: Adapt Rest Transport to use the proto generated types Jan 9, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @guglielmo-san, 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 significantly updates the data handling within the REST transport layer by migrating to Protocol Buffer generated types. This change aims to enhance data consistency and interoperability across the system by enforcing a structured data format for all API interactions. The implementation includes comprehensive conversion mechanisms to ensure compatibility between the existing application logic and the new protobuf structures.

Highlights

  • Protocol Buffer Integration: The REST transport layer has been refactored to utilize Protocol Buffer (proto) generated types for API requests and responses, standardizing data structures.
  • New Dependencies and Build Steps: New dependencies for protobuf generation and handling (ts-proto, @bufbuild/buf, @bufbuild/protobuf, google-proto-files) have been added, along with new npm scripts to automate proto type generation.
  • Breaking Change: This pull request introduces a breaking change due to the direct use of proto types in the REST transport handler, requiring updates to how data is sent and received.
  • Conversion Utilities: New utility modules (FromProto, ToProto, id_decoding) have been introduced to facilitate seamless conversion between existing internal data models and the new proto types.
  • Updated API Handlers and Tests: Both client-side (rest_transport.ts) and server-side (rest_handler.ts) API handlers, along with their respective tests, have been updated to incorporate the new proto types and conversion logic.
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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 9, 2026

🧪 Code Coverage

⬇️ Download Full Report

Main PR Delta
src/client/transports/rest_transport.ts 84.52% 85.8% 🟢 +1.28%
src/server/express/rest_handler.ts 83.71% 85.76% 🟢 +2.05%
src/types/converters/from_proto.ts (new) 51.27%
src/types/converters/id_decoding.ts (new) 52%
src/types/converters/to_proto.ts (new) 49.28%
Total 82.74% 76.12% 🔴 -6.62%

Generated by coverage-comment.yml

Copy link
Copy Markdown
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 is a significant and well-executed refactoring to adopt Protobuf-generated types for the REST transport layer. This is a great improvement for type safety and consistency across the client and server. The changes are comprehensive, touching the client transport, server handler, and updating tests accordingly. I've identified a few minor issues, including a potential runtime error from a missing type cast, a duplicated test assertion, a method name typo, and an incorrect path in a build script. Overall, this is a high-quality contribution.

@guglielmo-san
Copy link
Copy Markdown
Member Author

/gemini review

Copy link
Copy Markdown
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 successfully refactors the REST transport to use Protobuf-generated types, which is a significant improvement for ensuring payload compatibility with other A2A SDKs. The introduction of ToProto and FromProto utility classes is a good design choice for centralizing the conversion logic. The changes are consistently applied across both client and server implementations, and the tests have been largely updated to reflect this.

I've identified a few areas for improvement, mainly concerning test correctness and a small opportunity for code deduplication to enhance maintainability. My specific comments are detailed below.

@guglielmo-san guglielmo-san requested a review from ishymko January 12, 2026 10:26
@guglielmo-san guglielmo-san marked this pull request as ready for review January 12, 2026 10:26
@guglielmo-san guglielmo-san requested a review from a team as a code owner January 12, 2026 10:26
@guglielmo-san guglielmo-san requested a review from ishymko January 12, 2026 16:23
@guglielmo-san guglielmo-san requested a review from ishymko January 13, 2026 11:32
@guglielmo-san guglielmo-san enabled auto-merge (squash) January 13, 2026 17:08
@guglielmo-san guglielmo-san merged commit d2efc4c into a2aproject:main Jan 13, 2026
14 checks passed
@guglielmo-san guglielmo-san deleted the fix_rest branch January 13, 2026 17:08
ishymko added a commit that referenced this pull request Jan 14, 2026
# Description

Bring back TCK capabilities tests for REST and use
[0.3.0.beta3](https://github.com/a2aproject/a2a-tck/releases/tag/0.3.0.beta3)
tag, both work now after #292.
ishymko pushed a commit that referenced this pull request Jan 15, 2026
🤖 I have created a release *beep* *boop*
---


## [0.3.8](v0.3.7...v0.3.8)
(2026-01-15)


### ⚠ BREAKING CHANGES

* use ProtoJSON for REST transport
([#292](#292))

### Features

* use case-insensitive transport protocol name comparison in
ClientFactory
([5246067](5246067))


### Bug Fixes

* add typesVersions to support legacy module resolution
([#288](#288))
([6499e29](6499e29))
* use ProtoJSON for REST transport
([#292](#292))
([d2efc4c](d2efc4c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
ishymko added a commit that referenced this pull request Mar 13, 2026
Apparently the code removed in #346 wasn't "dead", this method was missed in #292.
ishymko added a commit that referenced this pull request Mar 13, 2026
Apparently the code removed in #346 wasn't "dead", this method was missed in #292.
ishymko added a commit that referenced this pull request Mar 13, 2026
Apparently the code removed in #346 wasn't "dead", this method was missed in #292.
ishymko added a commit that referenced this pull request Mar 13, 2026
Apparently the code removed in #346 wasn't "dead", this method was missed in #292.
ishymko added a commit that referenced this pull request Mar 16, 2026
…352)

Apparently the code removed in #346 wasn't "dead", this method wasn't
properly migrated in #292.

Tests are updated to cover this.

Fixes #336
ikubicki pushed a commit to ikubicki/a2a-js that referenced this pull request Mar 19, 2026
…2aproject#352)

Apparently the code removed in a2aproject#346 wasn't "dead", this method wasn't
properly migrated in a2aproject#292.

Tests are updated to cover this.

Fixes a2aproject#336
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.

HTTP+JSON payload shape mismatches proto‑JSON (ADK/Agent Engine 400s)

2 participants