Skip to content

Commit d68c52e

Browse files
committed
docs(iceberg): update JSON schema translation behavior
Resolves https://redpandadata.atlassian.net/browse/DOC-1957
1 parent f8d4bd6 commit d68c52e

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

modules/manage/pages/iceberg/specify-iceberg-schema.adoc

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ Requirements:
275275
276276
- Only JSON Schema Draft-07 is currently supported.
277277
- You must declare the JSON Schema dialect using the `$schema` keyword, for example `"$schema": "http://json-schema.org/draft-07/schema#"`.
278-
- You must use a JSON Schema that constrains JSON documents to a strict type in order for Redpanda to translate to Iceberg; that is, each subschema must use the `type` keyword.
278+
- You must use a JSON Schema that constrains JSON documents to a strict type so Redpanda can translate to Iceberg. In most cases this means each subschema uses the `type` keyword, but a subschema can also use `$ref` if the referenced schema resolves to a strict type.
279279
280280
.Valid JSON Schema example
281281
[,json]
@@ -310,7 +310,7 @@ Requirements:
310310
311311
| null
312312
|
313-
| The `null` type is not supported except when it is paired with another type to indicate nullability.
313+
| The `null` type is only supported as a nullability marker, either in a `type` array (for example, `["string", "null"]`) or in an exclusive `oneOf` nullable pattern.
314314
315315
| number
316316
| double
@@ -325,8 +325,8 @@ Requirements:
325325
| The `format` keyword can be used for custom Iceberg types. See <<format-translation,`format` annotation translation>> for details.
326326
327327
| object
328-
| struct
329-
| The `properties` keyword must be used to define `struct` fields and constrain their types. The `additionalProperties` keyword is accepted only when it is set to `false`.
328+
| struct or map
329+
| Use `properties` to define `struct` fields and constrain their types. `additionalProperties: false` is supported for closed objects. A schema-valued `additionalProperties` object is translated to an Iceberg `map<string, T>`. You cannot combine `properties` and schema-valued `additionalProperties` in the same object.
330330
331331
|===
332332
@@ -341,13 +341,20 @@ Requirements:
341341
342342
|===
343343
344+
Keyword behavior:
345+
346+
* The `$ref` keyword is supported for internal references resolved from schema resources declared in the same document (using `$id`), including relative and absolute URI forms. References to external resources and references to unknown keywords are not supported. A root-level `$ref` schema is not supported.
347+
* The `oneOf` keyword is supported only for the nullable serializer pattern where exactly one branch is `{"type":"null"}` and the other branch is a non-null schema (`T|null`).
348+
* In Iceberg output, Redpanda writes all fields as nullable regardless of serializer nullability annotations.
349+
344350
The following are not supported for JSON Schema:
345351
346-
* Relative and absolute (including external) references using `$ref` and `$dynamicRef` keywords
352+
* The `$dynamicRef` keyword
347353
* The `default` keyword
348-
* Conditional typing (`if`, `then`, `else`, `dependent` keywords)
349-
* Boolean JSON Schema combinations (`allOf`, `anyOf`, `oneOf` keywords)
350-
* Dynamic object members (`patternProperties` and `additionalProperties` (except when it is set to `false`) keywords)
354+
* Conditional typing (`if`, `then`, `else`, `dependencies` keywords)
355+
* Boolean JSON Schema combinations (`allOf`, `anyOf`, and non-nullable `oneOf` patterns)
356+
* Dynamic object members with the `patternProperties` keyword
357+
* `additionalProperties: true`
351358
--
352359
353360
======

0 commit comments

Comments
 (0)