of

fun of(catalogs: List<CatalogDefinition>, limits: ValidationLimits = ValidationLimits.DEFAULT): CatalogValidator

A validator over catalogs, each keyed by its own catalogId.

Catalogs are re-encoded here rather than being taken as raw documents so that a caller can pass what it already holds: a catalog arrives decoded, in a renderer's capabilities or inlined in an agent's, and re-parsing the wire text to check against it would mean keeping both forms. The encoding is faithful — a decoded definition carries its original object and emits it verbatim — so the document $ref resolution sees is the one that arrived.

Two catalogs sharing a catalogId resolve to the last one given, and two sharing a JSON Schema $id resolve to the FIRST. The two keys are independent -- $id is a free string that need not equal catalogId -- so a renderer that mixes its own catalogs with ones an agent inlined cannot order the list to be safe on both, and should refuse the duplicate before it gets here. Neither ordering lets an inlined catalog displace the catalog a payload actually names: the one in play answers for its own URI whatever else claimed it (see SchemaRegistry.document).