Module: A2A::Protocol::Protobuf

Defined in:
lib/a2a/protocol/protobuf.rb

Overview

Parses the A2A protocol's .proto file to extract service operations and bridge them to Schema definition classes for request/response validation.

The .proto file is the single normative source for the A2A protocol. This module extracts the service definition (RPC names, request/response types, streaming flags, HTTP bindings) and connects each operation to the corresponding Schema class so callers can validate data:

op = A2A::Protocol::Protobuf.operation("SendMessage")
op.request_schema.new(params).valid!
op.response_schema.new(result).valid!

A2A::Protocol::Protobuf.operations
#=> [Operation("SendMessage", ...), Operation("GetTask", ...), ...]

Defined Under Namespace

Classes: HttpBinding, Operation

Constant Summary collapse

PROTO_PATH =
File.expand_path("../../../data/a2a.proto", __dir__).freeze

Class Method Summary collapse

Class Method Details

.operation(name) ⇒ Object



87
88
89
# File 'lib/a2a/protocol/protobuf.rb', line 87

def operation(name)
  operations.find { |op| op.name == name }
end

.operationsObject



83
84
85
# File 'lib/a2a/protocol/protobuf.rb', line 83

def operations
  @operations ||= parse_operations
end

.reset!Object

Reset cached state (for tests).



92
93
94
# File 'lib/a2a/protocol/protobuf.rb', line 92

def reset!
  @operations = nil
end