CatalogDefinition

data class CatalogDefinition(val catalogId: String, val protocolVersion: String? = null, val title: String? = null, val description: String? = null, val instructions: String? = null, val components: Map<String, ComponentDefinition> = emptyMap(), val functions: Map<String, FunctionDefinition> = emptyMap(), val schemaKeywords: Map<String, JsonElement> = emptyMap())

A collection of component and function definitions that a surface renders against.

components and functions hold their definitions keyed by type name.

schemaKeywords carries $schema, $id, and $defs through unread. A definition may reference #/$defs/..., so dropping them would leave a re-encoded catalog — an inline one carried in RendererCapabilitiesV1.inlineCatalogs, say — with unresolvable references.

The specification's "Catalog Entity Naming Rules" are an invariant of this type rather than of its serializer, and checkEntityNames is where they are stated. A catalog reaches a checker three ways and only one of them decodes, so a rule enforced on the way in from the wire would leave dev.ynagai.a2ui.core.validation.CatalogValidator.of and dev.ynagai.a2ui.core.validation.CompositionValidator — both of which take definitions directly — holding catalogs no wire catalog could be.

A name this type accepts is a name a formatString expression can call. The rule enforced here is the specification's, answered from the derived XID_Start and XID_Continue tables, and the expression parser behind the formatString function judges the names inside a ${…} by the same tables -- it is mentioned here because this is where a name is accepted. 0.1.0 shipped with the parser on an approximation of its own that disagreed in both directions (#45).

That invariant is established at construction, which is all a constructor can do: the maps passed to it must not be retained and mutated by the caller. components, functions and schemaKeywords are held as given rather than copied, so a caller that keeps a MutableMap it passed in and writes to it afterwards puts names into this catalog that the check never saw, and the serializer will then emit them. Pass a map this type can own — a literal, a buildMap, or toMap() on anything still reachable from the caller. Decoded catalogs are unaffected: the serializer builds their maps and hands over the only reference.

Constructors

Link copied to clipboard
constructor(catalogId: String, protocolVersion: String? = null, title: String? = null, description: String? = null, instructions: String? = null, components: Map<String, ComponentDefinition> = emptyMap(), functions: Map<String, FunctionDefinition> = emptyMap(), schemaKeywords: Map<String, JsonElement> = emptyMap())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

protocolVersion with the schema default applied.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val schemaKeywords: Map<String, JsonElement>
Link copied to clipboard