How-to
Attach a schema to a topic
Add a data contract so everyone agrees what the data looks like
What you'll achieve
A data contract (schema) attached to a topic, so every application writing to it agrees on what the data looks like.
Before you start
- The topic already exists — schemas are always created from a topic's page, never on their own. (Need one? Create a topic first.)
- Your role badge says Developer or higher and the environment allows changes (in a read-only environment only admins can do this) — otherwise the topic page shows "Contact an admin to create a data contract" instead of a button.
- You have the schema text (usually provided by the team building the application), or you start from the built-in sample.
Steps
- Click Topics in the sidebar, open your topic, and go to the Data contract tab.
- Choose Value (the message content — the usual choice) or Key (the message's identifier) with the toggle at the top of the tab.
- Click Create data contract.
- On the form, pick the Type: Avro (default), JSON Schema, or Protobuf — whichever the application team told you to use. The name is chosen for you: the topic name plus -value or -key.
- Replace the sample in the Data Contract editor with your schema text. Use the Validate JSON button above the editor to check it — you want the green "Valid JSON".
- Click Create Data Contract.
What success looks like
You land back on the Topics list. Open the topic's Data contract tab again and the schema is shown; it also now appears in the Schemas list in the sidebar.
Something went wrong?
- A red "Invalid JSON: …" box — the schema text has a typo; fix it and validate again.
- A "Topic Required" warning — you opened the create form directly instead of from a topic's Data contract tab; go back to step 1.
- No Create data contract button, just "Contact an admin to create a data contract" — you don't have edit rights here; ask your team's admin.
Background — schema types, naming, and compatibility rules? Read the Schemas guide.