Matching: is this event schema change backward, forward, full or breaking? Intermediate
Estimated reading time: 1 min read
Four services consume OrderPlaced and deploy on their own schedules, so every schema change meets readers and writers of different versions. Drag a verdict onto each change.
- Each explanation names the side that breaks: the new consumer reading old records or the old consumer reading new records.
- Avro verdicts follow the Avro spec’s Schema Resolution rules and were reproduced with
avsc; the Protobuf case follows the proto3 guide.
Which compatibility does this schema change have?
The topic orders.order-placed carries OrderPlaced v1 (Avro unless noted). Four consumers (billing, inventory, email, analytics) deploy independently. Drag a verdict onto each change.
Tip: ask two questions. Can a new reader read old records? (backward) Can an old reader read new records? (forward) Both yes = full, both no = breaking.
Tap Choose answer on each case. On a computer you can drag a card below onto a case.
Solved 0/8 · 0 mistakes
1Add a currency field with a default.
{ "name": "currency", "type": "string", "default": "VND" }2Add a currency field without a default.
{ "name": "currency", "type": "string" }3Remove the optional couponCode field, which v1 declared with a default.
// v1
{ "name": "couponCode", "type": ["null", "string"], "default": null }
// v2: field removed4Rename amount to totalAmount without an alias.
// v1
{ "name": "amount", "type": "long" }
// v2
{ "name": "totalAmount", "type": "long" }5Widen amount from int to long because large orders overflow.
// v1
{ "name": "amount", "type": "int" }
// v2
{ "name": "amount", "type": "long" }6Narrow amount from long to int to save space.
// v1
{ "name": "amount", "type": "long" }
// v2
{ "name": "amount", "type": "int" }7Protobuf: field string coupon_code = 7 was deleted last quarter. A new field reuses number 7.
message OrderPlaced {
string order_id = 1;
int64 discount = 7; // was: string coupon_code = 7
}8Add symbol REFUNDED to the status enum. The v1 enum has no default.
// v1
{ "type": "enum", "name": "Status", "symbols": ["PLACED", "PAID"] }
// v2
{ "type": "enum", "name": "Status", "symbols": ["PLACED", "PAID", "REFUNDED"] }For deploy order, Schema Registry modes and how to ship a breaking change, read event schema evolution.