Contracts & the catalog

Versioned contracts in Apicurio and discovery plus lineage in OpenMetadata, and why a catalog is a mesh requirement, not an optional add-on.

⏱ 25 minSection 5

Learning objectives

By the end of this chapter you can:

  • Classify a given contract as a runtime contract or a discovery contract, and explain why the coupling differs between the two.
  • Name the four contract types each service produces and where each one lives in Apicurio.
  • Trace how OpenMetadata ingests from the registry, the database, and Kafka to assemble a catalog with lineage.
  • Explain why a catalog is a requirement in a data mesh rather than optional tooling, and what a mesh degrades into without one.

Why this matters

The previous page established that each service is a data product. But a data product is only useful to other domains if they can find it, understand its shape, trust that it won’t change out from under them, and trace where its data came from. That’s what this page is about: the registry that holds every product’s contract, and the catalog that makes the products discoverable and their lineage visible. This is the data-as-a-product and federated-governance principles made operational, and the place where “catalog” stops being an add-on and becomes a requirement.

Every protocol is a contract

order-service alone speaks four different shapes: a REST API described by OpenAPI, a gRPC surface described by Protobuf, an orders.placed event described by a schema, and (through the gateway) a slice of GraphQL SDL. Every protocol the mesh speaks is a contract. Left informal, these contracts drift: a field gets renamed, a type changes, and a consumer three domains away breaks with no warning. The mesh’s answer is to give every contract a versioned home in a single registry, regardless of its format.

Each service's contract surface: OpenAPI, Protobuf, schema, SDL

This final project uses Apicurio as that registry, holding all four contract types as their native artifacts: the event schemas, the gRPC Protobuf definitions, the REST OpenAPI documents, and the gateway’s GraphQL SDL. One registry, every contract, so there’s a single place to ask “what is this product’s shape, and what version am I depending on?”

Two jobs the registry does: runtime vs. discovery

Here’s the distinction that makes the registry more than a documentation folder, and it’s worth getting clear because the two jobs have very different coupling.

How a contract flows: the runtime path versus the discovery path

Runtime contracts

A runtime contract is essential on the hot path. The event schema is the example: the producer serializes an event against the registered schema and the consumer deserializes against it, so the event literally won’t encode or decode correctly if the contract is wrong or missing. The registry sits in the live path of every event. (The gRPC Protobuf definitions work the same way in spirit, though they’re compiled ahead of time rather than fetched at runtime.) Because a runtime contract is essential to execution, the registry can enforce real governance on it: reject a schema-incompatible change at publish time, before it can break a single consumer.

Discovery contracts

A discovery contract is different. The OpenAPI document and the GraphQL SDL get published as the source of truth for a product’s shape, but nothing fails at runtime if they’re absent. They exist for humans reading the API, for breaking-change checks in CI, and for the catalog to ingest. They describe; they don’t serialize.

The same registry does both jobs, but the coupling differs. The runtime path is tightly coupled and online; the discovery path is loosely coupled and offline. Conflate them, treat a discovery contract as if it were enforced at runtime, or a runtime contract as if it were just documentation, and that’s how teams get surprised in both directions.

The catalog: discovery and lineage

When an order is placed, an event flows to inventory, payment, and notification. If the order schema changes, what breaks downstream? A registry can’t answer that on its own: it tells you the shape of each contract, but not which products exist, who owns them, who consumes whom, or where a given piece of data ultimately came from. That’s the catalog’s job.

Contracts in the registry, discovery and lineage in the catalog

This final project layers OpenMetadata on top as the catalog. It ingests from the registry (the contracts), from the database (the schemas each domain owns), and from the event backbone (the topics), and assembles the picture a consumer actually needs: the products that exist, their schemas, their owners, and their lineage, the who-produces-and-who-consumes graph across domains. The catalog records the order-to-inventory-to-payment-to-notification path directly, so you can answer that question without reverse-engineering it from code.

The sequencing matters and reflects a real dependency: the registry comes before the catalog, because a catalog with nothing to catalog is empty. The contracts have to exist before lineage over them can be built.

Why this is a requirement, not an add-on

It’s tempting to treat a catalog as a nice-to-have you bolt on once the “real” system works. In a data mesh it’s the opposite, and this is the central point of the page. The entire premise of a mesh is that domains own their data independently and other domains consume it without a central team brokering access. That premise only works if products are discoverable and their contracts are trustworthy.

Without a registry, contracts drift and consumers break silently. Without a catalog, nobody can find products or understand lineage, so in practice they fall back to asking the central team, which reintroduces exactly the bottleneck the mesh exists to remove.

So discovery infrastructure isn’t decoration on top of a mesh; it’s structural to it. A mesh without a usable catalog degrades into the proxy anti-pattern: a central team back in the middle of every cross-domain question, even if every other piece is in place. The registry and catalog are what let federated governance be computational: contracts enforced at publish time, lineage recorded automatically as part of deploying, rather than standards administered by meeting.

One operational note belongs to building this rather than to the concept: when the catalog ingests by running jobs in the cluster, those jobs have to stay out of the service mesh, or they can’t complete. That’s a real sharp edge we hit, and it lives with the operational gotchas rather than here. But it’s worth knowing that the catalog’s ingestion has a deployment subtlety when a mesh is in play.

With products that describe themselves and a catalog that makes them discoverable, the next question is how data actually moves between them: the synchronous read paths and the asynchronous event backbone.

For deeper coverage

  • Data Mesh by Zhamak Dehghani: data-as-a-product and federated computational governance, the two principles this chapter makes operational.
  • Designing Data-Intensive Applications, 2nd ed. by Martin Kleppmann & Chris Riccomini: schema evolution and the compatibility guarantees a registry enforces.
  • Cloud Native Anti-Patterns by Gerald Bachlmayr et al.: the proxy anti-pattern a mesh degrades into without a usable catalog.
  • Apicurio Registry documentation: contract versioning and compatibility rules across schemas, Protobuf, OpenAPI, and GraphQL SDL.