Getting started with Schema Registry
Written by
Updated at October 28, 2024
Manage schema versions with Schema Registry.
Note
This feature is in the Preview stage.
Create a namespace
Management console
- In the management console
, select the folder you want to create a connection in. - Select Yandex MetaData Hub.
- In the left-hand panel, select
Schema Registry / Namespace. - Click Create namespace.
- Specify the following parameters:
- Name: Unique namespace name.
- Optionally, add a connection description and a label.
- Compatibility check level
BACKWARD
: (Default) Consumers using the new schema can read data written by producers using the latest registered schema.BACKWARD_TRANSITIVE
: Consumers using the new schema can read data written by producers using all previously registered schemas.FORWARD
: Consumers using the latest registered schema can read data written by producers using the new schema.FORWARD_TRANSITIVE
: Consumers using all previously registered schemas can read data written by producers using the new schema.FULL
: New schema is forward and backward compatible with the latest registered schema.FULL_TRANSITIVE
: New schema is forward and backward compatible with all previously registered schemas.NONE
: Schema compatibility checks are disabled.
For more information about schema compatibility types, see the Confluent documentation .
- Compatibility check rules: Select the types of schema checks you would like to have, i.e., Confluent
(default) or Buf .
- Click Create.
Upload a schema to a subject
Management console
API
- In the left-hand panel, select
Schemas. - Click Upload schema.
- Select the method for schema uploading into the new subject and specify the following parameters:
- Name: Unique subject name.
- Optionally, add a connection description and a label.
- Optionally, specify the Compatibility check level if you need to change the level inherited from the namespace:
BACKWARD
: (Default) Consumers using the new schema can read data written by producers using the latest registered schema.BACKWARD_TRANSITIVE
: Consumers using the new schema can read data written by producers using all previously registered schemas.FORWARD
: Consumers using the latest registered schema can read data written by producers using the new schema.FORWARD_TRANSITIVE
: Consumers using all previously registered schemas can read data written by producers using the new schema.FULL
: New schema is forward and backward compatible with the latest registered schema.FULL_TRANSITIVE
: New schema is forward and backward compatible with all previously registered schemas.NONE
: Schema compatibility checks are disabled.
For more information about schema compatibility types, see the Confluent documentation .
- Set the schema format to Avro
, JSON Schema , or Protobuf and attach the file. - If a schema references another schema, in the References section, click
and enter the reference name, the subject name the schema is registered under for reference purposes, and the registered subject's schema version. - Select Normalization to apply data schema normalization
. - If you want to skip schema compatibility checking, enable the relevant option.
- Click Upload schema.
-
Install cURL
. -
Log in to perform operations in the API.
-
In the settings of the created namespace copy its ID.
-
Use the POST API method to upload and register the schema for a subject. Provide the following in the request:
subject
: Subject name for uploading schemas.subject
: Name of the schema you want to upload to the specified subject.schemaType
: Schema type: Avro , JSON Schema , or Protobuf .
curl \ --request POST "https://<namespace_ID>.schema-registry.yandexcloud.net/v1/namespace"\ --header "accept: application/json" \ --header "Authorization: <token>" \ --header "Content-Type: application/json" \ --data "{ \ "schema": "{ \"type": <type>, \"name": "<schema_name>, \"fields":[schema_fields]} }' \ $<namespace_ID>/subjects/<subject_name>/versions {"id":1}
What's next
After you create a namespace and register a schema: