pub struct CommandSchema {
pub request: Option<Value>,
pub response: Option<Value>,
}Expand description
A request/response JSON-Schema pair attached to a CommandDef.
Both slots are optional; absent means “no payload expected” (the
TypeScript equivalent is v.void()). When populated the value is a
raw JSON Schema; the registry normalizes incoming schemas so wire
representations remain language-agnostic.
Fields§
§request: Option<Value>§response: Option<Value>Implementations§
Source§impl CommandSchema
impl CommandSchema
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Empty schema — both slots unset. Equivalent to advertising a
command with request: None, response: None (the void/void
shape). Use when the command takes no payload and returns none.
Sourcepub fn permissive() -> Self
pub fn permissive() -> Self
Maximally permissive schema — both request and response declared
as open objects with additionalProperties: true. Useful for
runtime plugins whose payload shape isn’t known at advertise
time (e.g. Flow’s QuickJS SourceChannel when a plugin exports
an any → any function).
Prefer a real schema when you can produce one — consumers use it for validation, MCP tool schemas, and generated TS clients.
Sourcepub fn with_request(self, schema: Value) -> Self
pub fn with_request(self, schema: Value) -> Self
Builder: set only the request schema (leaves response unset).
Sourcepub fn with_response(self, schema: Value) -> Self
pub fn with_response(self, schema: Value) -> Self
Builder: set only the response schema (leaves request unset).
Trait Implementations§
Source§impl Clone for CommandSchema
impl Clone for CommandSchema
Source§fn clone(&self) -> CommandSchema
fn clone(&self) -> CommandSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CommandSchema
impl Debug for CommandSchema
Source§impl<'de> Deserialize<'de> for CommandSchema
impl<'de> Deserialize<'de> for CommandSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for CommandSchema
impl PartialEq for CommandSchema
Source§fn eq(&self, other: &CommandSchema) -> bool
fn eq(&self, other: &CommandSchema) -> bool
self and other values to be equal, and is used by ==.