Class LogicalTypeToDdlConverter
java.lang.Object
io.confluent.kafka.schemaregistry.type.logical.LogicalTypeToDdlConverter
Emits a
LogicalType as DDL text — the inverse of
LogicalTypesSchemaVisitor. Output is canonical (one statement per
line; struct bodies multi-line when more than two fields). Round-trips
through the visitor produce an equivalent LogicalType.
Lossy points (intentional, matching visitor capability):
- External references have no syntactic marker — they're inferred on
read-back from usage.
USING TYPEstatements survive (carrying the wire-format URI binding) but bare externals (no URI) are implicit, identified by appearing in a type position without a matching localSTRUCT/ENUM. - Path-keyed
defaultValuesaren't re-emitted; field-level defaults survive viaSchema.Field.getDefaultValue(). - The single-root sugar is detected and the trailing root-registration
TYPEstatement is elided when it would be redundant. There is no multi-root UNION sugar: when several independent types are unreferenced, root inference selects the first declared and the rest remain peer named types; a UNION-of-named-types root must be written explicitly (TYPE UNION(...)).
A named inline root — a bare STRUCT/ENUM carrying
LogicalType.getName() (e.g. an unwrapped Protobuf message) — is emitted as a named
declaration and round-trips: the visitor unwraps a leaf named root back to a bare body carrying
LogicalType.name (see LogicalTypesSchemaVisitor.maybeUnwrapNamedRoot), so the
bare-root + name shape is preserved through LT → DDL → LT.
-
Method Summary
-
Method Details
-
toDdl
-