Skip to main content

Module catalog

Module catalog 

Source
Expand description

Component catalogs: what a surface is allowed to contain.

A catalog names the component types and functions a surface may use, the properties each component takes, which of those properties are structural (they hold component ids rather than data), and any composition constraints. Agent and renderer must agree on one, identified by an opaque catalogId.

Two ways in:

  • Catalog::basic — the 18-component standard catalog, built in.
  • Catalog::from_schema — parse any A2UI catalog JSON Schema document, which is how custom design systems are described.

§Structural properties are what make validation possible

The specification is explicit that a catalog must type child references as ComponentId or ChildList rather than as bare strings — a validator decides which fields are structural links by looking for exactly those references. A raw "type": "string" is treated as static text (a URL, a label) and its target is never checked. PropKind preserves that distinction.

§Property types are carried, not interpreted

Each property also keeps the JSON type its schema pins it to (PropType), which is what lets crate::validate reject {"columns": "three"} where the catalog says integer. That is one constraint out of JSON Schema, not an engine: pattern, minimum, additionalProperties and the rest are left to whatever validates the document itself. A property whose schema states no type, or states several, is PropType::Unconstrained and is never rejected — a catalog this crate reads loosely must not turn into false failures.

Structs§

Catalog
A set of component and function definitions, identified by catalogId.
ComponentDef
One component type in a catalog.
ComponentRef
One component id reference found inside a component.
CompositionViolation
A composition-constraint failure.
FunctionDef
One function in a catalog.
PropDef
One property of a component type.

Enums§

CompositionCode
Error codes the specification assigns to composition failures.
PropKind
How a component property participates in the component graph.
PropType
The JSON type a property’s schema pins its value to.

Constants§

BASIC_COMPONENTS
Component types of the basic catalog, in specification order.
BASIC_FUNCTIONS
Function names of the basic catalog.
BASIC_ICON_NAMES
Icon names the basic catalog’s Icon component accepts.
COMMON_PROPS
Optional properties every component carries, whatever its type.