Skip to main content

AcceptedFields

Trait AcceptedFields 

Source
pub trait AcceptedFields {
    // Required method
    fn accepted_fields() -> &'static [&'static str];
}
Expand description

The JSON keys a request type accepts, in both protobuf spellings.

The A2A specification requires implementations to ignore unrecognized fields for forward compatibility (§11, graded by the official TCK as DM-SERIAL-005), so a misspelled parameter cannot be rejected — a client that asks for one context’s tasks and types contxtId gets every task back, with no error, and no way to tell.

Ignoring a field silently and ignoring it observably are different things, and only the first is required. A server can honour §11 on the wire while still telling its operator what it threw away. That is what this trait is for: it lets the JSON-RPC binding diff the request’s keys against the ones the method actually understands, and log the difference.

Implementations are hand-written but not hand-trusted: proto_field_alias.rs derives the expected set for each type from a2a.proto and asserts equality, so a schema change or a typo here fails the build rather than quietly shrinking what gets reported.

Required Methods§

Source

fn accepted_fields() -> &'static [&'static str]

Every JSON key this type accepts, sorted, with no duplicates.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§