Skip to content

feat(server): validate presence according to google.api.field_behavior annotations#870

Draft
ishymko wants to merge 8 commits into1.0-devfrom
ishymko/845-validation
Draft

feat(server): validate presence according to google.api.field_behavior annotations#870
ishymko wants to merge 8 commits into1.0-devfrom
ishymko/845-validation

Conversation

@ishymko
Copy link
Member

@ishymko ishymko commented Mar 19, 2026

Fixes #845

@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 significantly improves the robustness of the server by introducing automatic validation of incoming request parameters. By leveraging google.api.field_behavior annotations, the server now enforces the presence of required fields in Protobuf messages. This change ensures data integrity at the API boundary and provides clients with structured, actionable feedback when validation fails, streamlining the development and debugging experience.

Highlights

  • Server-Side Protobuf Validation: Implemented server-side validation for incoming Protobuf messages, enforcing the presence of required fields based on google.api.field_behavior annotations.
  • Automated Validation Decorator: Introduced a validate_request_params decorator that automatically applies validation to RequestHandler methods, streamlining the integration of validation logic.
  • Enhanced Error Reporting: Improved gRPC and JSON-RPC error handling to include detailed validation errors in the response data field, providing clients with structured and actionable feedback.
  • Comprehensive Testing: Added new unit and integration tests to thoroughly cover the new validation logic and ensure correct error reporting across different scenarios.
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.

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.

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 introduces a robust validation mechanism for incoming Protobuf messages based on google.api.field_behavior annotations. The changes correctly propagate detailed validation errors through both gRPC and JSON-RPC transport layers, providing more informative feedback to clients. The addition of the validate_request_params decorator centralizes this validation logic, ensuring consistency across request handlers. The accompanying tests adequately cover the new validation functionality, including edge cases like missing required fields and nested message validation. Overall, this is a significant improvement for API robustness and developer experience.

@ishymko ishymko force-pushed the ishymko/845-validation branch from 51f99ae to b891f34 Compare March 19, 2026 14:50
@ishymko ishymko force-pushed the ishymko/845-validation branch from 773a7c9 to a5f48cb Compare March 19, 2026 15:10
@github-actions
Copy link

🧪 Code Coverage (vs 1.0-dev)

⬇️ Download Full Report

Base PR Delta
src/a2a/client/transports/grpc.py 89.23% 90.14% 🟢 +0.91%
src/a2a/client/transports/jsonrpc.py 86.71% 86.81% 🟢 +0.09%
src/a2a/client/transports/rest.py 91.52% 92.73% 🟢 +1.21%
src/a2a/server/request_handlers/default_request_handler.py 96.89% 96.99% 🟢 +0.10%
src/a2a/server/request_handlers/grpc_handler.py 94.48% 94.89% 🟢 +0.41%
src/a2a/server/request_handlers/request_handler.py 100.00% 90.48% 🔴 -9.52%
src/a2a/server/request_handlers/rest_handler.py 93.75% 94.12% 🟢 +0.37%
src/a2a/utils/proto_utils.py 91.23% 90.36% 🔴 -0.87%
Total 91.45% 91.49% 🟢 +0.04%

Generated by coverage-comment.yml

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.

1 participant