Skip to content

Commit dd145b9

Browse files
Feediver1claudepgellertkbatuigas
authored
DOC-1790: Schema Registry Metadata Properties (#1690)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Gellért Peresztegi-Nagy <gellert.nagy@redpanda.com> Co-authored-by: Kat Batuigas <36839689+kbatuigas@users.noreply.github.com>
1 parent 2421601 commit dd145b9

7 files changed

Lines changed: 210 additions & 0 deletions

File tree

modules/ROOT/nav.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@
434434
**** xref:reference:rpk/rpk-registry/rpk-registry-compatibility-level.adoc[]
435435
***** xref:reference:rpk/rpk-registry/rpk-registry-compatibility-level-get.adoc[]
436436
***** xref:reference:rpk/rpk-registry/rpk-registry-compatibility-level-set.adoc[]
437+
**** xref:reference:rpk/rpk-registry/rpk-registry-context.adoc[]
438+
***** xref:reference:rpk/rpk-registry/rpk-registry-context-delete.adoc[]
439+
***** xref:reference:rpk/rpk-registry/rpk-registry-context-list.adoc[]
437440
**** xref:reference:rpk/rpk-registry/rpk-registry-mode.adoc[]
438441
***** xref:reference:rpk/rpk-registry/rpk-registry-mode-get.adoc[]
439442
***** xref:reference:rpk/rpk-registry/rpk-registry-mode-reset.adoc[]

modules/get-started/pages/release-notes/redpanda.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ xref:manage:schema-reg/schema-reg-contexts.adoc[Schema Registry contexts] are na
8383

8484
To enable contexts, set xref:reference:properties/cluster-properties.adoc#schema_registry_enable_qualified_subjects[`schema_registry_enable_qualified_subjects`] to `true` and restart your brokers. Once enabled, you reference schemas using qualified subject syntax, for example `:.staging:my-topic-value`. See xref:manage:schema-reg/schema-reg-contexts.adoc[] for configuration examples and limitations.
8585

86+
== Schema Registry metadata properties
87+
88+
xref:manage:schema-reg/schema-reg-overview.adoc#metadata-properties[Schema Registry metadata properties] let you store and retrieve arbitrary key-value pairs alongside schemas. Properties such as `owner`, `team`, or `application.version` travel with the schema through its lifecycle, making it easier to track ownership and lineage without modifying the schema itself.
89+
90+
You can set metadata when registering a schema using the `POST /subjects/{subject}/versions` endpoint or with the xref:reference:rpk/rpk-registry/rpk-registry-schema-create.adoc[`--metadata-properties`] flag in `rpk registry schema create`. Metadata is returned in `GET /subjects/{subject}/versions/{version}` and `GET /schemas/ids/{id}` responses, and viewable with `rpk registry schema get --print-metadata`. New schema versions automatically inherit metadata from the most recent version of the subject unless you register with an explicit empty `metadata` object.
91+
8692
== New configuration properties
8793

8894
**Storage mode:**

modules/manage/pages/schema-reg/schema-reg-overview.adoc

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,53 @@ ifndef::env-cloud[]
159159
Additionally, you cannot have xref:manage:schema-reg/schema-id-validation.adoc#about-schema-id-validation[schema ID validation] with JSON schemas if the xref:manage:schema-reg/schema-id-validation.adoc#set-subject-name-strategy-per-topic[subject name strategy] _is not_ `TopicNameStrategy`.
160160
endif::[]
161161

162+
[#metadata-properties]
163+
== Metadata properties
164+
165+
Schema Registry lets you store and retrieve arbitrary key-value metadata properties alongside schemas. Properties such as `owner`, `team`, or `application.version` travel with the schema through its lifecycle. You can register a new schema with associated metadata properties by sending a `POST` request to `/subjects/{subject}/versions` with a `metadata.properties` object in the request body:
166+
167+
[,json]
168+
----
169+
{
170+
"schema": "{\"type\":\"string\"}",
171+
"metadata": {
172+
"properties": {
173+
"owner": "platform-team",
174+
"application.version": "2.1.0"
175+
}
176+
}
177+
}
178+
----
179+
180+
To set metadata using rpk, use the xref:reference:rpk/rpk-registry/rpk-registry-schema-create.adoc[`--metadata-properties`] flag (shorthand: `-p`). The flag accepts `key=value` pairs or a JSON string (for example, `{"key":"value"}`), and you can pass it multiple times to set multiple properties:
181+
182+
[,bash]
183+
----
184+
# key=value pairs — pass the flag multiple times for multiple properties
185+
rpk registry schema create my-subject --schema schema.avsc \
186+
--metadata-properties owner=platform-team \
187+
--metadata-properties env=prod
188+
189+
# JSON string — useful when values contain special characters
190+
rpk registry schema create my-subject --schema schema.avsc \
191+
--metadata-properties '{"owner":"platform-team","application.version":"2.1.0"}'
192+
----
193+
194+
Metadata properties are returned on `GET /subjects/{subject}/versions/{version}` and `GET /schemas/ids/{id}` responses. To view metadata on an existing schema, add `--print-metadata` to `rpk registry schema get`. You can also view metadata properties in {ui}.
195+
196+
When you register a new schema version without a `metadata` field, the new version automatically inherits properties from the most recent version of that subject. To avoid inheriting the previous version's metadata, you can send `"metadata": {}` to register a schema with explicitly no metadata. Registering the same schema definition with different metadata properties creates a new schema version.
197+
198+
[NOTE]
199+
====
200+
Redpanda supports only `metadata.properties` from the Confluent Data Contracts specification. The following configuration objects are not supported:
201+
202+
* `metadata.tags`
203+
* `ruleSet`
204+
* `defaultMetadata` and `overrideMetadata` (configuration options)
205+
* `defaultRuleSet` and `overrideRuleSet` (configuration options)
206+
* `compatibilityGroup` (configuration option)
207+
====
208+
162209
== Next steps
163210

164211
* xref:manage:schema-reg/schema-reg-api.adoc[]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
= rpk registry context delete
2+
// tag::single-source[]
3+
4+
Delete a schema registry context.
5+
6+
A context can only be deleted once all subjects within it have been hard deleted. Soft-deleted subjects still block context deletion. Use `rpk registry subject delete --permanent` to hard delete subjects first.
7+
8+
The default context `.` cannot be deleted.
9+
10+
== Usage
11+
12+
[,bash]
13+
----
14+
rpk registry context delete [CONTEXT] [flags]
15+
----
16+
17+
== Flags
18+
19+
[cols="1m,1a,2a"]
20+
|===
21+
|*Value* |*Type* |*Description*
22+
23+
|-h, --help |- |Help for delete.
24+
25+
|--no-confirm |- |Disable confirmation prompt.
26+
27+
|--config |string |Redpanda or `rpk` config file; default search paths are `~/.config/rpk/rpk.yaml`, `$PWD`, and `/etc/redpanda/redpanda.yaml`.
28+
29+
|-X, --config-opt |stringArray |Override `rpk` configuration settings. See xref:reference:rpk/rpk-x-options.adoc[`rpk -X`] or execute `rpk -X help` for inline detail or `rpk -X list` for terser detail.
30+
31+
|--ignore-profile |- |Ignore `rpk.yaml` and `redpanda.yaml`; use default settings.
32+
33+
|--profile |string |Profile to use. See xref:reference:rpk/rpk-profile.adoc[`rpk profile`] for more details.
34+
35+
|--schema-context |string |Schema context to use for all registry operations.
36+
37+
|--skip-context-check |- |Skip the admin API verification of schema context support.
38+
39+
|-v, --verbose |- |Enable verbose logging.
40+
|===
41+
42+
// end::single-source[]
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
= rpk registry context list
2+
// tag::single-source[]
3+
4+
List schema registry contexts.
5+
6+
== Usage
7+
8+
[,bash]
9+
----
10+
rpk registry context list [flags]
11+
----
12+
13+
== Aliases
14+
15+
[,bash]
16+
----
17+
list, ls
18+
----
19+
20+
== Flags
21+
22+
[cols="1m,1a,2a"]
23+
|===
24+
|*Value* |*Type* |*Description*
25+
26+
|--format |string |Output format: `json`,`yaml`,`text`,`wide`,`help`. Default: `text`.
27+
28+
|-h, --help |- |Help for list.
29+
30+
|--config |string |Redpanda or `rpk` config file; default search paths are `~/.config/rpk/rpk.yaml`, `$PWD`, and `/etc/redpanda/redpanda.yaml`.
31+
32+
|-X, --config-opt |stringArray |Override `rpk` configuration settings. See xref:reference:rpk/rpk-x-options.adoc[`rpk -X`] or execute `rpk -X help` for inline detail or `rpk -X list` for terser detail.
33+
34+
|--ignore-profile |- |Ignore `rpk.yaml` and `redpanda.yaml`; use default settings.
35+
36+
|--profile |string |Profile to use. See xref:reference:rpk/rpk-profile.adoc[`rpk profile`] for more details.
37+
38+
|--schema-context |string |Schema context to use for all registry operations.
39+
40+
|--skip-context-check |- |Skip the admin API verification of schema context support.
41+
42+
|-v, --verbose |- |Enable verbose logging.
43+
|===
44+
45+
// end::single-source[]
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
= rpk registry context
2+
// tag::single-source[]
3+
4+
Manage schema registry contexts.
5+
6+
Schema contexts provide namespace isolation within the schema registry, allowing multiple independent sets of subjects and schemas to coexist.
7+
8+
Before using schema contexts, enable the xref:reference:properties/cluster-properties.adoc#schema_registry_enable_qualified_subjects[`schema_registry_enable_qualified_subjects`] cluster property:
9+
10+
[,bash]
11+
----
12+
rpk cluster config set schema_registry_enable_qualified_subjects true
13+
----
14+
15+
Use the `--schema-context` flag on the parent `registry` command to scope operations to a specific context.
16+
17+
== Usage
18+
19+
[,bash]
20+
----
21+
rpk registry context [flags]
22+
rpk registry context [command]
23+
----
24+
25+
== Flags
26+
27+
[cols="1m,1a,2a"]
28+
|===
29+
|*Value* |*Type* |*Description*
30+
31+
|-h, --help |- |Help for context.
32+
33+
|--config |string |Redpanda or `rpk` config file; default search paths are `~/.config/rpk/rpk.yaml`, `$PWD`, and `/etc/redpanda/redpanda.yaml`.
34+
35+
|-X, --config-opt |stringArray |Override `rpk` configuration settings. See xref:reference:rpk/rpk-x-options.adoc[`rpk -X`] or execute `rpk -X help` for inline detail or `rpk -X list` for terser detail.
36+
37+
|--ignore-profile |- |Ignore `rpk.yaml` and `redpanda.yaml`; use default settings.
38+
39+
|--profile |string |Profile to use. See xref:reference:rpk/rpk-profile.adoc[`rpk profile`] for more details.
40+
41+
|--schema-context |string |Schema context to use for all registry operations.
42+
43+
|--skip-context-check |- |Skip the admin API verification of schema context support.
44+
45+
|-v, --verbose |- |Enable verbose logging.
46+
|===
47+
48+
// end::single-source[]

modules/reference/pages/rpk/rpk-registry/rpk-registry-schema-create.adoc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,23 @@ Create a schema with a specific ID and version in import mode:
3838
rpk registry schema create foo --schema /path/to/file.proto --id 42 --schema-version 3
3939
----
4040

41+
Create a schema with metadata properties as key=value pairs:
42+
43+
[,bash]
44+
----
45+
rpk registry schema create foo --schema /path/to/file.proto \
46+
--metadata-properties owner=team-a \
47+
--metadata-properties env=prod
48+
----
49+
50+
Create a schema with metadata properties using JSON format:
51+
52+
[,bash]
53+
----
54+
rpk registry schema create foo --schema /path/to/file.proto \
55+
--metadata-properties '{"owner":"team-a","env":"prod"}'
56+
----
57+
4158
== Usage
4259

4360
[,bash]
@@ -55,6 +72,8 @@ rpk registry schema create SUBJECT --schema {filename} [flags]
5572

5673
|--id |int |Optional schema ID to use when creating the schema in import mode (default `-1`).
5774

75+
|-p, --metadata-properties |stringArray |Schema metadata properties as key=value pairs or JSON (for example, `{"key":"value"}`). You can pass this flag multiple times.
76+
5877
|--references |string |Comma-separated list of references (name:subject:version) or path to reference file.
5978

6079
|--schema |string |Schema filepath to upload, must be `.avro`, `.avsc`, or `.proto`.

0 commit comments

Comments
 (0)