pub struct SchemaSet { /* private fields */ }Expand description
The message schemas compiled against one catalog.
Implementations§
Source§impl SchemaSet
impl SchemaSet
Sourcepub fn for_catalog(catalog: &Catalog) -> Result<Self, CompileError>
pub fn for_catalog(catalog: &Catalog) -> Result<Self, CompileError>
Compile agent_to_renderer.json and renderer_to_agent.json with
catalog.json mapped to catalog.
Sourcepub fn for_document(catalog: &Value) -> Result<Self, CompileError>
pub fn for_document(catalog: &Value) -> Result<Self, CompileError>
As SchemaSet::for_catalog, from a catalog’s JSON document as it is,
unchecked. For the specification’s tests, which pair messages with
catalogs; use SchemaSet::for_catalog otherwise.
Sourcepub fn check_agent_message_as(
&self,
kind: &str,
message: &Value,
) -> Result<(), Vec<SchemaError>>
pub fn check_agent_message_as( &self, kind: &str, message: &Value, ) -> Result<(), Vec<SchemaError>>
Check a message against one kind’s definition ("createSurface", …).
Valid exactly when SchemaSet::check_agent_message is for a message
holding that kind’s key, with errors about that kind only.
Sourcepub fn check_agent_message(
&self,
message: &Value,
) -> Result<(), Vec<SchemaError>>
pub fn check_agent_message( &self, message: &Value, ) -> Result<(), Vec<SchemaError>>
Check one agent-to-renderer message against the envelope schema and the
catalog. This is the schema half of validation only: whether a surface
exists, whether root is there, and the composition rules are checked by
crate::Validator.
Sourcepub fn check_function_call(&self, call: &Value) -> Result<(), Vec<SchemaError>>
pub fn check_function_call(&self, call: &Value) -> Result<(), Vec<SchemaError>>
Check one function call ({"@call": ..., "args": ...}) against this
catalog’s functions: that it names one, and its arguments.
Sourcepub fn check_renderer_message(
&self,
message: &Value,
) -> Result<(), Vec<SchemaError>>
pub fn check_renderer_message( &self, message: &Value, ) -> Result<(), Vec<SchemaError>>
Check one renderer-to-agent message (an action, a function call or response, an error).