Compile-time catalog registry for A2UI component type validation.
The basic catalog is loaded from the official JSON Schema shipped in
priv/catalogs/basic_catalog.json. Valid component types are extracted
from the "components" keys at compile time.
Configuration
Custom catalogs can be registered at compile time. Values may be either
a path to a catalog JSON file (relative to the project root) whose
"components" keys are extracted, or an explicit list of type strings:
config :a2ui, catalogs: %{
"https://example.com/catalog.json" => "priv/catalogs/my_catalog.json",
"https://example.com/simple.json" => ["Text", "Button", "MyWidget"]
}The basic catalog ("https://a2ui.org/specification/v0_9/basic_catalog.json")
is always registered. Unknown catalog IDs are handled permissively — validation
is skipped when the renderer does not recognize the catalog. A nil catalog ID
also skips validation.
Summary
Functions
Returns the basic catalog ID URL string.
Validates that all component types are allowed by the given catalog.
Functions
@spec basic_catalog_id() :: String.t()
Returns the basic catalog ID URL string.
@spec validate_types([A2UI.Component.t()], String.t() | nil) :: :ok | {:error, {:invalid_component_types, [String.t()]}}
Validates that all component types are allowed by the given catalog.
Returns :ok when:
catalog_idisnil(validation skipped)catalog_idis not recognized (permissive — unknown catalogs are accepted)- All component types are present in the catalog
Returns {:error, {:invalid_component_types, types}} only when the
catalog is known and contains types not in its allowed set.