class Definition
Base class for schema-validated A2A protocol objects.
Each A2A definition type (Agent Card, Agent Capabilities, Task, etc.) gets a dynamically-generated subclass of Definition with:
- A JSONSchemer sub-schema attached (.schema)
- Reader methods for each property (snake_case)
- Validation via .valid? / .valid!
caps = A2A::Schema["Agent Capabilities"].new(
streaming: true,
push_notifications: false
)
caps.valid? #=> true
caps.streaming #=> true
caps.push_notifications #=> false
caps.to_h #=> "streaming" => true, "pushNotifications" => false
Definitions
def to_h
Returns the data as a plain Hash with camelCase string keys, matching the JSON wire format. Nested Definition instances are auto-coerced via deep_compact.
Implementation
def to_h
deep_compact(@data)
end