Module: A2A::Proto

Defined in:
lib/a2a/proto.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::Proto.operation("SendMessage")
op.request_schema.new(params).valid!
op.response_schema.new(result).valid!

A2A::Proto.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



86
87
88
# File 'lib/a2a/proto.rb', line 86

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

.operationsObject



82
83
84
# File 'lib/a2a/proto.rb', line 82

def operations
  @operations ||= parse_operations
end

.reset!Object

Reset cached state (for tests).



91
92
93
# File 'lib/a2a/proto.rb', line 91

def reset!
  @operations = nil
end