{"canonical_url":"https://engineer.company/glossary/schema-registry/","content_markdown":"# Schema registry\n\n## What it is\n\nA schema registry stores and identifies versions of the structures used to\nexchange data. A program can register a schema, retrieve it by an identifier,\nand compare a proposed version with earlier versions. In a message pipeline, a\nwriter can associate data with the schema that produced it, and a reader can use\nthat identity when decoding the stored bytes.\n\nThe exact arrangement depends on the chosen registry, serializer and encoding. A\nserializer can put a schema identifier into a message envelope, then write the\nencoded payload. A consumer that already knows that identifier can reuse its\ncached schema. Otherwise it needs a way to retrieve the schema that matches the\nmessage. The registry's version history and the message's schema identifier are\nboth useful. One tells you how the structure evolved. The other tells you what a\nparticular writer used.\n\nRegistries can check compatibility when a schema changes. A backward\ncompatibility policy can ask whether a reader using the new schema can read data\nwritten with a schema from before the change. A forward policy asks about the\nother direction. Full compatibility checks both directions, and a transitive\npolicy can check against a longer version history. The details of permitted\nchanges depend on the data format and the configured policy. Understanding those\ndetails is important when several consumer versions run at once.\n\n## Why it matters\n\nMessages can remain in a stream long after a writer has been upgraded. A\nconsumer doing recovery might start at an earlier point in the stream. It will\nthen encounter old records followed by records from several newer deployments. A\nschema registry links older and newer records to their respective schema\nversions so that a reader can decode each record correctly.\n\nA compatibility decision determines who can upgrade first. Suppose a shipment\nevent gains a tracking reference that older producers do not send. A new reader\nneeds an agreed behaviour for older records. An older reader handling records\nfrom a newer producer has a separate compatibility question. Test the actual\nencoded variants with the versions that may meet in production. Include records\nretained for replay and use the distinctions the application cares about, such\nas an absent field and an explicitly empty value.\n\nA structural check gives useful early feedback but has a specific scope. A\nproposed schema can keep a number field and still change what that number\nrepresents. A new interpretation of a shipping weight may need a new field or a\ncoordinated transition. Capture such decisions outside the encoding check too.\nBusiness examples and consumer contract tests can establish the meaning that the\nregistry's type system cannot express.\n\n## What it looks like in practice\n\nImagine three applications reading shipment events. One produces alerts, another\nrefreshes a dashboard, and the third rebuilds a historical projection after\noutages. Give a new schema a compatibility policy that reflects those lifetimes.\nInclude a sample encoded by the oldest supported writer and one produced by the\ncandidate writer. Exercise each supported reader, check the decoded values and\nrecord what happens when the registry cannot serve a schema briefly.\n\nKeep the operation recoverable. Record how the registry is backed up and what\nregistry data must accompany a stream restored in another environment. Some\nimplementations assign identifiers that are meaningful within one registry. An\nunfamiliar registry can associate the wrong schema with an identifier unless the\ndata and identity mappings migrate consistently. Restore a small historical\nsample and check what each payload actually decodes to. A successful backup\ncommand says little on its own about whether identifiers still refer to the\nright definitions.\n\nEngineer's\n[database-to-API contract case study](/portfolio/generated-the-api-contract-from-the-database-out/)\nillustrates the value of sharing definitions between independent release paths.\nIt documents generated API and client artefacts and checks for optional fields\nand enums. A stream registry solves a related coordination problem for\nserialized records. The example here uses message identities and versioned\ndecoding so a maintainer can relate a delivered payload to the specific schema\nthat produced it.\n\n## Where it goes wrong\n\nTeams sometimes treat a successful registration as proof that every deployed\nconsumer can handle the new records. Compatibility checks follow the configured\nmode and format. A policy that compares only with the last version may leave a\nmuch older consumer behind. Keep supported versions explicit and choose the\nregistration policy to cover their overlap. Run the older consumer tests on the\nnew records where its contribution matters.\n\nAvailability needs attention too. A producer may need registry access to resolve\nor register a schema under a new version. A consumer encountering an unfamiliar\nidentifier may need its first lookup before decoding. Plan for caching,\nconnection failures and clear diagnostics. Warm caches change what a load test\nobserves, so exercise a process that starts with no cached schemas. Check the\nintended response to an unavailable registry and to an identifier that has no\nentry.\n\nReview how writers select where to register. Applications that decode several\nevent types from one stream might organize compatibility by event type. Another\nteam might use one definition for the entire stream. Test what the serializer\nactually sends to the registry from each environment. A newly created\nregistration group with a permissive default can let a change through without\ncomparing it against the definitions consumers use. Reader and writer fixtures\nshould check that they refer to the intended version history.\n\nFinally, plan how definitions are retired. Old versions can remain important\nwhile records are retained or archived. A compatible change in a field\ndefinition also may have consequences for storage, application defaults or\nbusiness rules. Keep schema history discoverable, test a replay near the oldest\nsupported boundary, and require a documented decision before removing access to\nan identity used by existing records.\n\n## Further reading\n\n- [Confluent schema evolution and compatibility](https://docs.confluent.io/platform/current/schema-registry/fundamentals/schema-evolution.html).\n  Explains compatibility directions and policies for common formats.\n- [Introduction to Apicurio Registry](https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/getting-started/assembly-intro-to-the-registry.html).\n  Documents an alternative registry's artefacts and lifecycle.\n- [The Apache Avro specification](https://avro.apache.org/docs/current/specification/).\n  Describes writer and reader schema resolution and field defaults.\n\n\u003chttps://engineer.company/glossary/schema-registry/\u003e\n","date_modified":"2026-11-25T07:18:46Z","description":"See how a schema registry links payloads to their schemas and checks changes during a producer and consumer rollout.","formats":{"gemtext":"https://engineer.company/glossary/schema-registry/index.gmi","gopher":"https://engineer.company/glossary/schema-registry/gophermap","html":"https://engineer.company/glossary/schema-registry/","json":"https://engineer.company/glossary/schema-registry/index.json","markdown":"https://engineer.company/glossary/schema-registry/index.md","pdf":"https://engineer.company/glossary/schema-registry/index.pdf"},"kind":"page","language":"en","title":"What is a schema registry?","url":"https://engineer.company/glossary/schema-registry/","version":1}