Skip to content
Ameen Abozaid
SRC-006

API and data contracts

  • 6 Lessons
  • 3.5 h practice (estimate)
On this page 9 topics

Overview

Topics

  • Compatibility
  • versioning
  • consumer impact
  • schema governance

Learn first

3.5 h of practice (estimate)

Learning outcomes

  1. Define compatibility policies for APIs and events across teams.
  2. Assess the consumer impact of a proposed change using contract tests, usage data, and ownership maps.
  3. Establish schema governance (ownership, review, registry rules) without blocking teams.
  4. Plan multi-team migrations for breaking changes.

Lessons

  1. 01Contracts as promises between teams
  2. 02Compatibility policies
  3. 03Measuring consumer impact
  4. 04Schema governance that scales
  5. 05Coordinating breaking changes
  6. 06Demo: splitting OrderPlaced into two events across five consumers

Lab and exercises

Lab

SRC-006-LAB1 · Contract policy

Outcomes: 1–4 · Time: ~2 h

  1. Write the order domain's compatibility policy for REST APIs and events (allowed changes, notice, deprecation windows, registry mode).
  2. Define the governance: ownership, CI checks, review by exception.
  3. Pick one breaking change and build the impact map from registry, usage logs, and ownership data.
  4. Write the migration plan: sequence, owners, dates, verification, rollback.

Acceptance: plan names every consumer, the sequence, and the rollback.

Exercises (policy review; six exercises)

IDOutcomeTask
SRC-006-EX011Classify eight proposed changes (add optional field, rename field, change type, tighten validation, etc.) as compatible or breaking.
SRC-006-EX021Write a deprecation policy for public order APIs including notice period and signals.
SRC-006-EX032A producer wants to drop the couponCode field. List how you find who reads it and what you do if some consumers are unknown.
SRC-006-EX043Design CI checks and ownership rules that avoid a weekly schema review meeting.
SRC-006-EX054Plan the rename of customerId to accountId across four consumers with a rollback.
SRC-006-EX064Review a migration plan that removes the old field in the same release as consumers change; list its failures and a fix.
Show solutions
  • EX01 Compatible: add optional field. Breaking: rename, change type, remove, tighten validation that rejects previously valid data, change meaning or units.
  • EX02 For example: 6 months notice for public APIs, deprecation headers and release notes, usage tracking, sunset date, direct contact with top consumers.
  • EX03 Registry subjects and consumer groups, usage logs, contract tests, code search; for unknowns, keep the field with a deprecation notice and monitor reads or access, then remove after the window.
  • EX04 Registry compatibility check in CI, owners file, required docs, auto-tagging consumers on PR, human review only for breaking or cross-domain changes.
  • EX05 Add accountId while keeping customerId; dual publish; migrate consumers one by one with contract tests; verify customerId unused; remove; rollback by continuing to publish both.
  • EX06 Removing in the same release breaks consumers not yet changed and prevents rollback; fix with expand and contract and verified zero usage.

Workplace evidence: a breaking change you coordinated across teams.

Quiz

Outcomes: O1 compatibility policies · O2 consumer impact · O3 schema governance · O4 breaking-change migration.

A self-check for you: nothing is graded, saved or sent anywhere. Choose an answer, then check it. You can try again as often as you like.

  1. 1Which change is generally backward compatible?O1
  2. 2Changing a field's meaning but not its type is:O1
  3. 3A deprecation policy should define:O1
  4. 4Consumer-driven contract tests show:O2
  5. 5Unknown consumers are:O2
  6. 6To measure impact of a field change you can use:O2
  7. 7Governance that scales relies on:O3
  8. 8Every schema should have:O3
  9. 9Expand and contract means:O4
  10. 10Before removing an old event you should confirm:O4

Practical part

Six policy exercises SRC-006-EX01 to EX06 plus the lab. Pass: quiz at least 8/10, at least five exercises correct, and a policy and migration plan that names every consumer, the sequence, and the rollback.

Common mistakes

Governance by meeting; breaking changes discovered in production.

Assessment

Policy review.

Workplace evidence

A breaking change you coordinated across teams.

Career relevance

Event architecture and API management (ARC-025, ARC-026).

Type to search levels, phases, modules and lessons.