-
Notifications
You must be signed in to change notification settings - Fork 104
feat!: Trim io.a2a.apec package #556
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
Conversation
Summary of ChangesHello @kabir, 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 undertakes a significant refactoring effort within the A2A Java SDK. The primary goal is to enhance modularity and clarify the separation between public API specifications and internal implementation details. By creating a dedicated Highlights
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 introduces a new jsonrpc-common module and refactors the codebase to move JSON-RPC related classes into it, improving modularity. The renaming of JSONRPCRequest/Response to A2ARequest/Response and the replacement of JSONRPCError with A2AError are consistent and well-executed across the project. The changes are extensive but applied consistently. I have one critical comment regarding the class hierarchy of A2AError and one medium-severity comment about a small inconsistency in a utility class.
- Create A2AMethods interface with constants for all A2A protocol methods - Replace hardcoded method strings across all transport implementations - Update gRPC, JSONRPC, and REST transports to use centralized constants - Remove duplicate METHOD constants from individual request wrapper classes - Update all test files to use new method name constants - Clean up POM dependencies and update protobuf-maven-plugin to 4.0.3 This refactoring improves maintainability by having a single source of truth for method names and reduces the risk of typos or inconsistencies. Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
refactor: centralize A2A method names in A2AMethods interface
|
/gemini review |
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 introduces a significant and beneficial refactoring by creating a new jsonrpc-common module. This improves modularity by separating the JSON-RPC specific classes from the core spec module. The renaming of JSONRPCRequest/Response to A2ARequest/Response and replacing JSONRPCError with a more general A2AError that extends RuntimeException are excellent changes that clarify the codebase.
I've found a couple of minor issues related to this refactoring that I've commented on. One is an unused variable, and the other is a likely copy-paste error where an incorrect method constant is being used, which could affect interceptor logic.
Overall, this is a great set of changes that improves the project structure.
client/transport/rest/src/main/java/io/a2a/client/transport/rest/RestTransport.java
Outdated
Show resolved
Hide resolved
| GetAuthenticatedExtendedCardRequest getExtendedAgentCardRequest = GetAuthenticatedExtendedCardRequest.builder() | ||
| .jsonrpc(JSONRPCMessage.JSONRPC_VERSION) | ||
| .jsonrpc(A2AMessage.JSONRPC_VERSION) | ||
| .build(); // id will be randomly generated |
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.
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.
Not introduced with this PR, and whatever :-)
…ENDED_AGENT_CARD_METHOD
Introduce a new jsonrpc-common module, and move the io.a2a.spec Request and Response classes there since they are internal use now. The jsonrpc-common module also gets the JsonUtil and the various MappingExceptions. The spec package exceptions were tied to JSON-RPC. We decided to keep the `code` and `data` fields, which could be useful even when JSON-RPC is not used. But we got rid of the JSONRPCError class, and repurposes the A2AError interface to take its role. Also renamed JSONRPCRequest and JSONRPCResponse to be A2ARequest/-Response. Make A2AError extend RuntimeException rather than Error. --------- Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com> Co-authored-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Introduce a new jsonrpc-common module, and move the io.a2a.spec Request and Response classes there since they are internal use now.
The jsonrpc-common module also gets the JsonUtil and the various MappingExceptions.
The spec package exceptions were tied to JSON-RPC. We decided to keep the
codeanddatafields, which could be useful even when JSON-RPC is not used. But we got rid of the JSONRPCError class, and repurposes the A2AError interface to take its role.Also renamed JSONRPCRequest and JSONRPCResponse to be A2ARequest/-Response.
Make A2AError extend RuntimeException rather than Error.