of

fun of(documents: List<JsonObject>, activeCatalog: JsonObject? = null): SchemaRegistry

A registry over documents, each keyed by its own $id, with the FIRST to claim a URI keeping it.

Neither key may take a name CATALOG_PLACEHOLDER resolves to. catalogId is subject to the reservation exactly as $id is: the two passes differ in which one wins a contested name, and a name the placeholder joins to is contested by construction, since the only document entitled to answer there is whichever catalog is in play. See ProtocolSchemas.catalogPlaceholderUris.

activeCatalog is bound to CATALOG_PLACEHOLDER and answers for its own URI and its catalogId directly, so it does not depend on winning that race -- it is appended last, and under first-wins it would otherwise lose every collision. Passing it separately rather than inferring "the one that has a catalogId" keeps a catalog that inlines another one from silently taking over.