pub struct Catalog { /* private fields */ }Expand description
A loaded, checked catalog.
Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn basic() -> &'static Catalog
pub fn basic() -> &'static Catalog
The specification’s basic catalog (catalogs/basic/v1), vendored.
Sourcepub fn from_value(document: Value) -> Result<Catalog, CatalogError>
pub fn from_value(document: Value) -> Result<Catalog, CatalogError>
Load a catalog document, checking it against catalog_definition.json
and the rules the schema cannot express: protocolVersion must be
1.0; component, function, property, and $defs names must be UAX #31
identifiers; every $ref must target this catalog’s own components,
functions, or leaf $defs, or one of ALLOWED_EXTERNAL_REF_TARGETS;
and each component must declare component as the constant of its own
name. Nothing the document refers to is fetched.
Sourcepub fn instructions(&self) -> Option<&str>
pub fn instructions(&self) -> Option<&str>
The catalog’s instructions for the model, if it has any.
Sourcepub fn components(&self) -> &BTreeMap<String, ComponentDef>
pub fn components(&self) -> &BTreeMap<String, ComponentDef>
The component types, by name.
Sourcepub fn functions(&self) -> &BTreeMap<String, FunctionDef>
pub fn functions(&self) -> &BTreeMap<String, FunctionDef>
The functions, by name.
Sourcepub fn component(&self, name: &str) -> Option<&ComponentDef>
pub fn component(&self, name: &str) -> Option<&ComponentDef>
One component type, if the catalog has it.
Sourcepub fn function(&self, name: &str) -> Option<&FunctionDef>
pub fn function(&self, name: &str) -> Option<&FunctionDef>
One function, if the catalog has it.
Sourcepub fn declares(&self, type_name: &str, name: &str) -> bool
pub fn declares(&self, type_name: &str, name: &str) -> bool
Whether this catalog’s schema for component type_name declares a
property name: in its own properties, or those of any allOf,
oneOf, or anyOf branch, or of a $defs entry it refers to. A
component may declare catalogId, metadata, accessibility, or
checks as ordinary properties, which then are not the legacy spellings
of the @ envelope keys.
Sourcepub fn declares_own(&self, type_name: &str, name: &str) -> bool
pub fn declares_own(&self, type_name: &str, name: &str) -> bool
Whether name is component type_name’s own property here, not the
envelope’s: Catalog::declares, except that a catalogId or
metadata declared in a properties block that also declares id, in
the standard shape (a string catalogId, or a metadata object whose
only property is extensions), is the envelope’s, as early 1.0 drafts
inlined it.