Skip to main content
Protobuf brings its own compatibility model to the Schema Registry. Most of what makes a Protobuf change safe or unsafe comes from the field-numbering rules in the Protobuf specification rather than from the registry, so a schema that evolves correctly by Protobuf’s rules generally passes the registry’s check too.

Configure the serializer

And the deserializer, which needs the generated class:
Add the dependency:

Define a message

Handling null

proto3 has no null. A field that isn’t set reads back as its zero value—0, "", false—which means you can’t distinguish “not provided” from “explicitly zero” unless you ask for it. Use optional (the recommended approach, available in protoc 3.15 and later):
Use a wrapper type if you’re on an older protoc:
Wrappers work but add a level of nesting to every access. Prefer optional on any new schema.

Compatibility rules

Field numbers are identity in Protobuf. Names are labels; numbers are what’s on the wire. Always reserve a number you retire:
The compatibility matrix on Overview lists FORWARD, FORWARD_TRANSITIVE, FULL, and FULL_TRANSITIVE as unsupported for Protobuf. The API accepts those values on a Protobuf subject rather than rejecting them, but the combination isn’t validated or supported. Use BACKWARD or BACKWARD_TRANSITIVE for Protobuf subjects.

Schema references through imports

Protobuf’s import statement maps naturally onto schema references. The reference name is the import path:
Imports are registered recursively when auto-registration is on, so registering Customer also registers everything it imports. That’s convenient in development and worth turning off in production, where you want registration to be deliberate. See Auto-registration.

Multiple event types on one topic

Protobuf handles several message types on one topic more naturally than the other formats, through a wrapper with a oneof:
Alternatively, use RecordNameStrategy so each message type gets its own subject and evolves independently. See Multiple event types on one topic.

Normalization

?normalize=true performs real normalization for Protobuf.

Next steps

Avro

Defaults, aliases, and schema resolution.

JSON Schema

Open content models and per-construct compatibility.