refactor: remove custom a2a.json from json rpc FastAPI#850
refactor: remove custom a2a.json from json rpc FastAPI#850ishymko merged 2 commits intoa2aproject:1.0-devfrom
Conversation
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/server/apps/jsonrpc/fastapi_app.py | 63.41% | 82.35% | 🟢 +18.94% |
| Total | 90.10% | 90.22% | 🟢 +0.13% |
Generated by coverage-comment.yml
Summary of ChangesHello, 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 SDK by migrating its core data structures to Protocol Buffers, which improves robustness and interoperability. A major focus was also placed on ensuring backward compatibility with the previous v0.3 protocol, providing a smooth transition path for existing integrations. Additionally, the client-side request processing has been enhanced with a new interceptor pattern, and a dedicated CLI tool for database migrations has been introduced to manage schema updates effectively. Highlights
Changelog
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.
Code Review
This pull request refactors the JSON-RPC FastAPI application by removing the generation and usage of the custom a2a.json OpenAPI specification. The changes are logical as the OpenAPI file was not compatible with the JSON-RPC protocol implementation. The modifications include removing the OpenAPI generation plugin from buf.gen.yaml, deleting the custom A2AFastAPI class that loaded the schema, and removing the a2a.json file itself. My review has identified one high-severity issue where a dangling reference in the OpenAPI configuration will break schema generation. I've also included a low-severity suggestion for a follow-up cleanup in a related script.
I am having trouble creating individual review comments. Click here to see my feedback.
src/a2a/server/apps/jsonrpc/fastapi_app.py (144)
Using FastAPI directly is the right direction after removing the custom A2AFastAPI class. However, this change has a side effect. The custom openapi() method that loaded a2a.json is now gone, but add_routes_to_app still sets openapi_extra on the RPC endpoint with a $ref to #/components/schemas/A2ARequest. Since a2a.json is removed, this reference is now dangling and will break the generated OpenAPI schema.
To resolve this, the openapi_extra argument in add_routes_to_app should be removed. Since that part of the file is not in this diff, you might need to include it in this PR to fix the issue completely. Alternatively, you could exclude the endpoint from the schema by adding include_in_schema=False to the app.post() call.
buf.gen.yaml (32-35)
This change correctly removes the OpenAPI v2 JSON generation. As a follow-up, you might want to clean up the scripts/gen_proto.sh script, which contains logic to find and rename the generated *.swagger.json file. That part of the script is now obsolete and will print a warning on every run.
Description
This PR removes the generation and use of a2a.json.
Its content is not compatible with the JSON-RPC protocol, so there is no need to load it with the FastAPI server generation.