Skip to main content

Schema Registry Reference

Schemas is a registry for the contracts of your APIs and messages: the OpenAPI document of a REST API, the Avro schema of the records on a Kafka topic, the JSON Schema of a payload.

Rationale: Why contracts are kept apart from repositories.

Data model​

The registry has three levels. A group is a folder for related contracts; an artifact is one contract; a version is one state of its content. You address a contract by group, artifact and version.

LevelWhat it isConstraint
GroupA namespace, typically a business domain such as orders—
ArtifactOne contract, in one formatIts Artifact ID can never be changed
VersionOne state of the contentEarlier versions stay readable
Group by domain, not by team

Teams are reorganized; domains last. orders, billing, shipping stay meaningful when the team that owns them changes.

Schema Formats​

The format is chosen when the artifact is created and tells the editor how to validate and display the content.

FormatDescribesTypical use
OpenAPI 3.0A REST API: paths, operations, payloadsThe contract of an API exposed through a gateway
AsyncAPI 2.xAn event-driven API: channels, messages, bindingsTopics and queues shared between integrations
JSON SchemaThe structure of a JSON documentValidating a payload in a route
AvroA record, for compact binary serializationKafka records with schema evolution

Artifact metadata​

The ID is the technical identifier consumers use; the name and description are for people browsing the registry. Because the ID cannot be changed, treat it like an API: lowercase, stable, without a version number in it, since versions are a separate level.

FieldRule
Artifact IDStarts with a letter or a digit; letters, digits, dots, dashes and underscores. Immutable
Name200 characters at most
Description, LabelsFree

Compatibility between versions​

The registry stores every version you publish; it does not stop you from publishing a breaking one. Compatibility is a discipline of whoever owns the contract:

  • Adding an optional field is safe: consumers that do not know it ignore it.
  • Removing or renaming a field, or changing a type breaks consumers. Publish it as a new major version and keep the previous one in service until every consumer has moved.
A new version does not migrate anyone

Publishing version 4 changes nothing for a consumer reading version 3. Plan the migration of each consumer; the registry only makes both versions available.