← Concepts

阅读中文版本

Data Contract Versioning

Data contract versioning governs the evolution of the schema a producer and consumer agree on, so a producer can add a field without breaking consumers and a removal is a negotiated, versioned change.

data

Definition

Data contract versioning is the practice of versioning the schema that a data producer publishes and consumers depend on, so that additive changes (new optional fields) are backward-compatible and breaking changes (removals, type changes) are negotiated and released as a new version with a migration path, preventing a producer change from silently breaking every consumer.

Context and scope

Applied in data products, event streams, and any producer-consumer relationship where the producer evolves the schema and the consumers cannot all update simultaneously.

Common misconceptions

  • Versioning is just schema registry — a registry stores versions; versioning is the policy that governs which changes are compatible and how breaking changes are rolled out
  • Additive changes are always safe — they are safe for consumers that ignore unknown fields; for consumers that validate strictly, a new field can break them

Anti-patterns

  • Changing a field type in place and breaking every consumer that reads the field as the old type
  • Adding a required field without a default, so every existing record fails validation

Related concepts

Authoritative source

https://www.confluent.io/blog/data-contracts-schema-registry

What it is

Data contract versioning is the practice of versioning the schema that a data producer publishes and consumers depend on, so that additive changes (new optional fields) are backward-compatible and breaking changes (removals, type changes) are negotiated and released as a new version with a migration path, preventing a producer change from silently breaking every consumer. Applied in data products, event streams, and any producer-consumer relationship where the producer evolves the schema and the consumers cannot all update simultaneously. The data is the asset; the pipeline is the liability — it exists only to move and transform data correctly, on time, with a lineage that survives audit.

How it works

Schema is a contract enforced at ingestion, not discovered at query time: bad records are quarantined with their violation, not silently coerced. Transformations are deterministic and idempotent so re-runs repair rather than duplicate. Partitioning by event time (not processing time) makes late data correctable rather than lost. Lineage records every transformation so the path from source to dashboard is reconstructable.

When to apply and pitfalls

Apply when decisions are made from the data and a wrong decision has a cost. The pitfall is treating the pipeline as a one-way function and never validating its output against the source — silent drops and double-counts accumulate until a dashboard disagrees with the ledger. Another is optimizing for throughput at the cost of correctness, dropping the validation that would have caught the corruption.