MCPcopy Index your code
hub / github.com/confluentinc/schema-registry

github.com/confluentinc/schema-registry @v64.7.7.2-1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v64.7.7.2-1 ↗ · + Follow
11,939 symbols 44,045 edges 689 files 2,703 documented · 23%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Schema Registry

Confluent Schema Registry provides a serving layer for your metadata. It provides a RESTful interface for storing and retrieving your Avro®, JSON Schema, and Protobuf schemas. It stores a versioned history of all schemas based on a specified subject name strategy, provides multiple compatibility settings and allows evolution of schemas according to the configured compatibility settings and expanded support for these schema types. It provides serializers that plug into Apache Kafka® clients that handle schema storage and retrieval for Kafka messages that are sent in any of the supported formats.

This README includes the following sections:

Documentation

Here are a few links to Schema Registry pages in the Confluent Documentation.

Quickstart API Usage examples

The following assumes you have Kafka and an instance of the Schema Registry running using the default settings. These examples, and more, are also available at API Usage examples on docs.confluent.io.

# Register a new version of a schema under the subject "Kafka-key"
$ curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \
    --data '{"schema": "{\"type\": \"string\"}"}' \
    http://localhost:8081/subjects/Kafka-key/versions
  {"id":1}

# Register a new version of a schema under the subject "Kafka-value"
$ curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \
    --data '{"schema": "{\"type\": \"string\"}"}' \
     http://localhost:8081/subjects/Kafka-value/versions
  {"id":1}

# List all subjects
$ curl -X GET http://localhost:8081/subjects
  ["Kafka-value","Kafka-key"]

# List all schema versions registered under the subject "Kafka-value"
$ curl -X GET http://localhost:8081/subjects/Kafka-value/versions
  [1]

# Fetch a schema by globally unique id 1
$ curl -X GET http://localhost:8081/schemas/ids/1
  {"schema":"\"string\""}

# Fetch version 1 of the schema registered under subject "Kafka-value"
$ curl -X GET http://localhost:8081/subjects/Kafka-value/versions/1
  {"subject":"Kafka-value","version":1,"id":1,"schema":"\"string\""}

# Fetch the most recently registered schema under subject "Kafka-value"
$ curl -X GET http://localhost:8081/subjects/Kafka-value/versions/latest
  {"subject":"Kafka-value","version":1,"id":1,"schema":"\"string\""}

# Delete version 3 of the schema registered under subject "Kafka-value"
$ curl -X DELETE http://localhost:8081/subjects/Kafka-value/versions/3
  3

# Delete all versions of the schema registered under subject "Kafka-value"
$ curl -X DELETE http://localhost:8081/subjects/Kafka-value
  [1, 2, 3, 4, 5]

# Check whether a schema has been registered under subject "Kafka-key"
$ curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \
    --data '{"schema": "{\"type\": \"string\"}"}' \
    http://localhost:8081/subjects/Kafka-key
  {"subject":"Kafka-key","version":1,"id":1,"schema":"\"string\""}

# Test compatibility of a schema with the latest schema under subject "Kafka-value"
$ curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \
    --data '{"schema": "{\"type\": \"string\"}"}' \
    http://localhost:8081/compatibility/subjects/Kafka-value/versions/latest
  {"is_compatible":true}

# Get top level config
$ curl -X GET http://localhost:8081/config
  {"compatibilityLevel":"BACKWARD"}

# Update compatibility requirements globally
$ curl -X PUT -H "Content-Type: application/vnd.schemaregistry.v1+json" \
    --data '{"compatibility": "NONE"}' \
    http://localhost:8081/config
  {"compatibility":"NONE"}

# Update compatibility requirements under the subject "Kafka-value"
$ curl -X PUT -H "Content-Type: application/vnd.schemaregistry.v1+json" \
    --data '{"compatibility": "BACKWARD"}' \
    http://localhost:8081/config/Kafka-value
  {"compatibility":"BACKWARD"}

Installation

You can download prebuilt versions of the schema registry as part of the Confluent Platform. To install from source, follow the instructions in the Development section.

Deployment

The REST interface to schema registry includes a built-in Jetty server. The wrapper scripts bin/schema-registry-start and bin/schema-registry-stop are the recommended method of starting and stopping the service.

Development

To build a development version, you may need a development versions of common and rest-utils. After installing these, you can build the Schema Registry with Maven.

This project uses the Google Java code style to keep code clean and consistent.

To build:

mvn compile

To run the unit and integration tests:

mvn test

To run an instance of Schema Registry against a local Kafka cluster (using the default configuration included with Kafka):

mvn exec:java -pl :kafka-schema-registry -Dexec.args="config/schema-registry.properties"

To create a packaged version, optionally skipping the tests:

mvn package [-DskipTests]

It produces:

  • Schema registry in package-schema-registry/target/kafka-schema-registry-package-$VERSION-package
  • Serde tools for avro/json/protobuf in package-kafka-serde-tools/target/kafka-serde-tools-package-$VERSION-package

Each of the produced contains a directory layout similar to the packaged binary versions.

You can also produce a standalone fat JAR of schema registry using the standalone profile:

mvn package -P standalone [-DskipTests]

This generates package-schema-registry/target/kafka-schema-registry-package-$VERSION-standalone.jar, which includes all the dependencies as well.

OpenAPI Spec

OpenAPI (formerly known as Swagger) specifications are built automatically using swagger-maven-plugin on compile phase.

Contribute

Thanks for helping us to make Schema Registry even better!

  • Source Code: https://github.com/confluentinc/schema-registry
  • Issue Tracker: https://github.com/confluentinc/schema-registry/issues

License

The project is licensed under the Confluent Community License, except for the client-* and avro-* libs, which are under the Apache 2.0 license. See LICENSE file in each subfolder for detailed license agreement.

Extension points exported contracts — how you extend this code

ReferenceSubjectNameStrategy (Interface)
A io.confluent.kafka.serializers.subject.strategy.ReferenceSubjectNameStrategy is used by the serializer to dete [11 implementers]
schema-serializer/src/main/java/io/confluent/kafka/serializers/subject/strategy/ReferenceSubjectNameStrategy.java
SchemaValidator (Interface)
A SchemaValidator has one method, which validates that a ParsedSchema is compatible with the other sc [8 implementers]
client/src/main/java/io/confluent/kafka/schemaregistry/SchemaValidator.java
KeyMessageOrBuilder (Interface)
(no doc) [17 implementers]
protobuf-converter/src/test/java/io/confluent/connect/protobuf/test/Key.java
DecimalValuePb2OrBuilder (Interface)
(no doc) [10 implementers]
protobuf-serializer/src/test/java/io/confluent/kafka/serializers/protobuf/test/DecimalValuePb2OuterClass.java
KmsDriver (Interface)
(no doc) [6 implementers]
client-encryption-tink/src/main/java/io/confluent/kafka/schemaregistry/encryption/tink/KmsDriver.java
LeaderElector (Interface)
(no doc) [12 implementers]
core/src/main/java/io/confluent/kafka/schemaregistry/storage/LeaderElector.java
WidgetBytesOrBuilder (Interface)
(no doc) [8 implementers]
client-encryption/src/test/java/io/confluent/kafka/schemaregistry/rules/WidgetBytesProto.java
SpecificWidgetOrBuilder (Interface)
(no doc) [9 implementers]
schema-rules/src/test/java/io/confluent/kafka/schemaregistry/rules/SpecificWidgetProto.java

Core symbols most depended-on inside this repo

put
called by 1902
core/src/main/java/io/confluent/kafka/schemaregistry/storage/Store.java
get
called by 1686
core/src/main/java/io/confluent/kafka/schemaregistry/storage/Store.java
of
called by 551
client/src/main/java/io/confluent/kafka/schemaregistry/client/rest/entities/ServerClusterId.java
size
called by 438
client/src/main/java/io/confluent/kafka/schemaregistry/client/rest/utils/UrlList.java
add
called by 386
dek-registry/src/main/java/io/confluent/dekregistry/metrics/MetricsManager.java
name
called by 379
client/src/main/java/io/confluent/kafka/schemaregistry/ParsedSchema.java
get
called by 371
client/src/main/java/io/confluent/kafka/schemaregistry/client/security/SslFactory.java
schema
called by 331
client/src/main/java/io/confluent/kafka/schemaregistry/ParsedSchemaHolder.java

Shape

Method 10,876
Class 913
Interface 107
Enum 43

Languages

Java100%

Modules by API surface

protobuf-serializer/src/test/java/io/confluent/kafka/serializers/protobuf/test/NestedTestProto.java462 symbols
schema-rules/src/test/java/io/confluent/kafka/schemaregistry/rules/WidgetProto2.java289 symbols
protobuf-serializer/src/test/java/io/confluent/kafka/serializers/protobuf/test/TestMessageProtos.java260 symbols
schema-rules/src/test/java/io/confluent/kafka/schemaregistry/rules/WidgetProto.java254 symbols
schema-rules/src/test/java/io/confluent/kafka/schemaregistry/rules/NewWidgetProto.java254 symbols
protobuf-serializer/src/test/java/io/confluent/kafka/serializers/protobuf/test/CustomOptions.java190 symbols
client-encryption/src/test/java/io/confluent/kafka/schemaregistry/rules/WidgetProto.java187 symbols
protobuf-converter/src/test/java/io/confluent/connect/protobuf/test/MapReferences.java184 symbols
schema-rules/src/test/java/io/confluent/kafka/schemaregistry/rules/WidgetWithRefProto.java174 symbols
client/src/main/java/io/confluent/kafka/schemaregistry/utils/BoundedConcurrentHashMap.java167 symbols
protobuf-serializer/src/test/java/io/confluent/kafka/serializers/protobuf/test/CustomOptions2.java160 symbols
avro-data/src/test/java/io/confluent/connect/avro/AvroDataTest.java156 symbols

For agents

$ claude mcp add schema-registry \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page