pub struct CatalogRegistry { /* private fields */ }Expand description
The catalogs an agent knows about.
Names are how the application refers to a catalog; ids are what goes on the
wire. They are usually different — a registry entry called "standard" may
carry catalogId: "https://a2ui.org/..." — so the registry keeps both and
CatalogRegistry::supported_catalog_ids reports the wire ids.
Implementations§
Source§impl CatalogRegistry
impl CatalogRegistry
Sourcepub fn insert(&mut self, name: impl Into<String>, schema: Value)
pub fn insert(&mut self, name: impl Into<String>, schema: Value)
Registers a catalog document under a local name.
Sourcepub fn load(
&mut self,
name: impl Into<String>,
path: impl AsRef<Path>,
) -> Result<()>
pub fn load( &mut self, name: impl Into<String>, path: impl AsRef<Path>, ) -> Result<()>
Registers a catalog document read from disk.
§Errors
Returns Error::Catalog if the file cannot be read or is not JSON.
Sourcepub fn relax_strict_validation(&mut self)
pub fn relax_strict_validation(&mut self)
Applies additionalProperties relaxation to every registered catalog.
Structured-output APIs reject schemas that forbid extra properties, so this is usually applied at load time when the catalogs feed one.
Sourcepub fn entries(&self) -> &[RegistryEntry]
pub fn entries(&self) -> &[RegistryEntry]
The registered catalogs, in registration order.
Sourcepub fn schemas(&self) -> Vec<Value>
pub fn schemas(&self) -> Vec<Value>
The catalog documents, for select_catalog_schema.
Sourcepub fn supported_catalog_ids(&self) -> Vec<String>
pub fn supported_catalog_ids(&self) -> Vec<String>
The wire ids of every registered catalog.
Sourcepub fn get(&self, id: &str) -> Option<&RegistryEntry>
pub fn get(&self, id: &str) -> Option<&RegistryEntry>
Looks a catalog up by wire id or by local name.
Sourcepub fn select(
&self,
capabilities: &ClientCapabilities,
accepts_inline: bool,
) -> Result<SchemaBundle>
pub fn select( &self, capabilities: &ClientCapabilities, accepts_inline: bool, ) -> Result<SchemaBundle>
Trait Implementations§
Source§impl Clone for CatalogRegistry
impl Clone for CatalogRegistry
Source§fn clone(&self) -> CatalogRegistry
fn clone(&self) -> CatalogRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more