Schema Registry

Managing schema evolution and compatibility checks

Overview

Confluent Schema Registry provides a serving layer for your metadata. It provides a RESTful interface for storing and retrieving your Avro schemas. This project includes Gradle tasks to register schemas and validate compatibility.

Registering Schemas

The repo is preconfigured to register `customerrecord` against a local registry.

./gradlew schemas:generateSchema schemaRegistryRegister

This registers the schema at `http://localhost:8081` with the subject `customerrecord-value`.

Compatibility Checks

Before deploying changes, you can verify they are compatible with previous versions.

⚡️ Fast Check

./gradlew schemaRegistryCompatibility

Fails the build if your local `.avsc` files are incompatible with the registry.

Detailed Diff

For a detailed breakdown of why a schema is incompatible, use the `schemaDiff` task:

./gradlew schemaDiff -Pold=original.avsc -Pnew=updated.avsc

Evolution Rules

✅ Compatible

Adding an optional field with a default value.

union {null, string} note = null;

❌ Incompatible

Adding a required field (no default value).

string note;