Problem
Producers change operational tables or events without knowing downstream pipelines depend on them. Dashboards and models break silently, and ownership of the fix is unclear.
Also known as: data-contract, producer-consumer-data-agreements
Define an explicit, enforced agreement between data producers and consumers on schema, semantics and quality.
Producers change operational tables or events without knowing downstream pipelines depend on them. Dashboards and models break silently, and ownership of the fix is unclear.
A data contract is an API-style agreement about a dataset or event stream. It moves quality responsibility to the producer, who publishes a stable interface rather than leaking internal tables.
The contract lives in version control next to the producing service and is machine-readable.
id: orders.v2
owner: checkout-team
schema:
order_id: string, required, unique
total: decimal(12,2), min 0
status: enum [placed, paid, shipped, cancelled]
sla: freshness 15m, completeness 99.9%
change_policy: additive only within v2
In CI, the build compares the proposed schema to the published contract and fails on incompatible changes such as removing a field or tightening a type. At runtime, producers serialize with a registry such as Avro or Protobuf schemas, and pipelines run checks on null rates, ranges and freshness. Violations route records to a dead-letter location and alert the owner, not consumers.
Consumer-driven testing complements this: consumers register the fields they use, so producers see impact before changing.
Low - schema registry and CI checks
Medium - contract lifecycle and consumer registry
Low - familiar API versioning idea
Contract documents drift from actual data
Producers bypass checks and break consumers
Overly rigid contracts block legitimate change