Summary
Move ValidateVersionHeader out of the REST and JSON-RPC transport implementations into a dedicated validator class. Transports should own the validator via composition and invoke it when validating incoming requests.
Motivation
REST and JSON-RPC transports currently carry transport-local version header validation logic. As more transport-level validation has moved behind shared validator classes, version validation should follow the same pattern to keep transport classes focused on routing, parsing, and response mapping.
Proposed Change
- Add a server-side validator class, for example
VersionHeaderValidator.
- Store the required version-header policy in the validator constructor.
- Replace
RestServerTransport::ValidateVersionHeader and JsonRpcServerTransport::ValidateVersionHeader with direct calls to the composed validator.
- Keep transport-specific error response formatting in the transport classes.
- Add or update focused unit/functional coverage for:
- missing
A2A-Version when required,
- missing
A2A-Version when optional,
- unsupported
A2A-Version,
- accepted supported version.
Acceptance Criteria
- REST and JSON-RPC transports no longer define private
ValidateVersionHeader member functions.
- Both transports compose and invoke the shared version validator.
- Existing version validation behavior and protocol error mapping remain unchanged.
- Formatting, unit tests, and clang-tidy pass.
Summary
Move
ValidateVersionHeaderout of the REST and JSON-RPC transport implementations into a dedicated validator class. Transports should own the validator via composition and invoke it when validating incoming requests.Motivation
REST and JSON-RPC transports currently carry transport-local version header validation logic. As more transport-level validation has moved behind shared validator classes, version validation should follow the same pattern to keep transport classes focused on routing, parsing, and response mapping.
Proposed Change
VersionHeaderValidator.RestServerTransport::ValidateVersionHeaderandJsonRpcServerTransport::ValidateVersionHeaderwith direct calls to the composed validator.A2A-Versionwhen required,A2A-Versionwhen optional,A2A-Version,Acceptance Criteria
ValidateVersionHeadermember functions.