Configure the serializer
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):
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:
Schema references through imports
Protobuf’simport statement maps naturally onto schema references. The reference name is the
import path:
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 aoneof:
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.