CatalogValidator

Checks components and function calls against the catalogs a renderer holds.

The two checks are the same SchemaEvaluator applied at two places, which is why they live together: a component's properties and a call's arguments are both described by JSON Schema in the same catalog, and both reach the same common_types.json definitions on the way.

A validator is built once per set of catalogs and is safe to keep: it re-encodes each catalog to the document form $ref resolution needs, and doing that per message would re-serialize every definition on every component.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The catalog ids this validator can check against.

Functions

Link copied to clipboard
fun resolve(explicit: String?, surfaceDefault: String?): CatalogResolution

The catalog a component or call belongs to.

Link copied to clipboard
fun validate(component: Component, surfaceDefault: String? = null): SchemaValidation

Whether component carries the properties its catalog declares for its type.

fun validate(call: FunctionCall, surfaceDefault: String? = null): SchemaValidation

Whether call's arguments match what its catalog declares for it.

Link copied to clipboard
fun validateMessage(message: JsonElement, direction: MessageDirection = MessageDirection.AGENT_TO_RENDERER, catalogId: String?): SchemaValidation

Whether a whole message, still in its wire form, matches the schema for its direction.