Skip to content

Commit 232c4eb

Browse files
mfernestclaudeFeediver1pgellertcoderabbitai[bot]
authored
fix(DOC-2061): clarify schema reference name field per schema type (#1613)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Joyce Fee <102751339+Feediver1@users.noreply.github.com> Co-authored-by: Gellért Peresztegi-Nagy <gellert.nagy@redpanda.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Joyce Fee <joyce@redpanda.com> Co-authored-by: Michele Cyran <michele@redpanda.com>
1 parent 3a47b9f commit 232c4eb

2 files changed

Lines changed: 19 additions & 8 deletions

File tree

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,23 @@ A successful registration returns the schema's `id`:
669669

670670
== Reference a schema
671671

672-
To build more complex schema definitions, you can add a reference to other schemas. The following example registers a Protobuf schema in subject `test-simple` with a message name `Simple`.
672+
To build more complex schema definitions, you can add a reference to other schemas. A reference identifies another schema using a `name`, `subject`, and `version`. The meaning of `name` depends on the schema type:
673+
674+
[cols="1,2"]
675+
|===
676+
| Schema type | Reference name
677+
678+
| Protobuf
679+
| The import path used in the `.proto` file (for example, `import "simple.proto";` uses name `simple.proto`).
680+
681+
| Avro
682+
| The schema name used by Avro resolution: fully qualified (`namespace.name`) when a namespace is defined, or just the record name when it is not (for example, `com.example.Address` or `Address`).
683+
684+
| JSON Schema
685+
| Used to identify the referenced schema in `$ref`. Redpanda's Schema Registry does not yet support external JSON Schema references (where `$ref` points to a schema registered under a different subject). To structure complex JSON schemas, define referenced types within the same schema document using `definitions` / `$defs` or bundled `$id` schemas. See xref:manage:schema-reg/schema-reg-overview.adoc#limitations[JSON Schema limitations].
686+
|===
687+
688+
The following example registers a Protobuf schema in subject `test-simple` with a message name `Simple`.
673689

674690
[tabs]
675691
====

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,9 @@ All CRUD operations are supported for the JSON Schema (`json-schema`), and Redpa
146146

147147
Schemas are held in subjects. Subjects have a compatibility configuration associated with them, either directly specified by a user, or inherited by the default. See `PUT /config` and `PUT/config/\{subject}` in the link:/api/doc/schema-registry/[Schema Registry API].
148148

149-
If you have inserted a second schema into a subject where the compatibility level is anything but `NONE`, then any JSON Schema containing the following items are rejected:
149+
JSON Schema supports internal references (`$ref` using JSON Pointer fragments such as `#/definitions/...` or `#/$defs/...`) and bundled schemas (sub-schemas with their own `$id` defined within the same document). These work correctly with all compatibility levels.
150150

151-
* `$ref`
152-
* `$defs` (`definitions` prior to draft 2019-09)
153-
* `dependentSchemas` / `dependentRequired` (`dependencies` prior to draft 2019-09)
154-
* `prefixItems`
155-
156-
Consequently, you cannot https://json-schema.org/understanding-json-schema/structuring[structure a complex schema^] using these features.
151+
External references, where `$ref` points to a schema registered under a different subject, are not supported. To https://json-schema.org/understanding-json-schema/structuring[structure complex JSON schemas^], define referenced types within the same schema document using `definitions` / `$defs` or bundled `$id` schemas.
157152

158153
ifndef::env-cloud[]
159154
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`.

0 commit comments

Comments
 (0)