-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: make a2a.proto the unique source of truth for Schema
#1168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: make a2a.proto the unique source of truth for Schema
#1168
Conversation
…ly source of truth, as a2a.ts is automatically generated from it
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary of ChangesHello @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 refactors the A2A project's type definition and generation system. The primary goal is to establish a single, authoritative source for all protocol types using Protocol Buffers, thereby eliminating redundancy and ensuring consistency across different communication protocols like gRPC and JSON-RPC. The changes involve splitting core definitions from service definitions, automating type generation, and streamlining the overall development workflow for protocol updates. Highlights
Ignored Files
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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 establish Protobuf as the single source of truth for A2A data models, which is a fantastic improvement for maintainability and consistency between the gRPC and JSON-RPC implementations. The splitting of the proto files into core data definitions and service definitions is a clean approach. I've identified a few minor issues, including a duplicated type, incorrect paths in documentation and scripts, and a field name that could be clearer. These are detailed in the specific comments below. Overall, this is a very strong and beneficial change for the project.
| @@ -220,7 +122,7 @@ message Part { | |||
| message FilePart { | |||
| oneof file { | |||
| string file_with_uri = 1; | |||
| bytes file_with_bytes = 2; | |||
| string file_with_bytes = 2; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type of this field has been changed to string, presumably to hold base64-encoded data. The name file_with_bytes is now potentially confusing. To improve clarity, I suggest renaming it to better reflect that it contains a string-encoded representation of the file bytes, for example file_content_base64.
| string file_with_bytes = 2; | |
| string file_content_base64 = 2; |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
A few observations and suggestions:
|
a2a.proto the unique source of truth for Schema
a2a.proto the unique source of truth for Schemaa2a.proto the unique source of truth for Schema
|
This is addressed in #1160 a2a.proto is now the source of truth for data definitions |
The goal of this PR is to propose a solution to this open task (#1150)
The current issue in the A2A project is the presence of
src/types/types.tsas second source of truth other than thea2a.proto.To fix this, the original
a2a.protohas been splitted into two files:a2a_grpc.proto: contains the gRPC Service definitionsa2a_types.proto: contains the message data defintion, common to gRPC ans JSONRpcThe
a2a_types.protois used to generate thea2a_types.ts, using thegenerate-typesscript command.a2a_types.tswill be generated in the folderdata\types, which already hosts the predefinedtypes_jsonrpc.ts. This file contains the message structure used by the JSONRpc, and will reference the types defined in thea2a_types.ts, generated froma2a_types.proto.This structure will guarantee that the messages used by JSONRpc and gRPC transports are coming from a single source of truth.
The
a2a_types.tsandtypes_jsonrpc.tsare then used to generate thea2a.jsonschema with thegeneratescript command, used within the A2A language specific repositories.The new folder structure will be: