Summary
When converting a KSML StructSchema to a Protobuf ProtoFileElement via ProtobufFileElementSchemaMapper.fromDataSchema(...), a field whose schema is a MapSchema is dropped with no error or warning.
proto3 does support map<K, V>, so this is a missing feature (map output not implemented), not a protobuf limitation.
Where
ksml-data-protobuf / ProtobufFileElementSchemaMapper:
convertDataSchemaToProtoType(...) returns null for a MapSchema.
convertStructSchemaToMessageElement(...) skips any field whose proto type is null.
Net effect: the map field silently disappears from the generated proto message.
Impact
Silent schema/data loss for map-typed fields when producing Protobuf. A struct with a map field converts to a proto message missing that field entirely.
Reproduction
fromDataSchema with a StructSchema containing a MapSchema field produces a MessageElement without that field. Currently guarded (documenting the behavior, not endorsing it) by ProtobufFileElementSchemaMapperTest.fromDataSchema_mapSchemaField_silentlyDropped.
Proposed fix
Implement map<K, V> output in the mapper (proto3 maps are modeled as a repeated nested entry message with key/value fields), and update the guard test to assert the emitted map field instead of its absence.
Summary
When converting a KSML
StructSchemato a ProtobufProtoFileElementviaProtobufFileElementSchemaMapper.fromDataSchema(...), a field whose schema is aMapSchemais dropped with no error or warning.proto3 does support
map<K, V>, so this is a missing feature (map output not implemented), not a protobuf limitation.Where
ksml-data-protobuf/ProtobufFileElementSchemaMapper:convertDataSchemaToProtoType(...)returnsnullfor aMapSchema.convertStructSchemaToMessageElement(...)skips any field whose proto type isnull.Net effect: the map field silently disappears from the generated proto message.
Impact
Silent schema/data loss for map-typed fields when producing Protobuf. A struct with a
mapfield converts to a proto message missing that field entirely.Reproduction
fromDataSchemawith aStructSchemacontaining aMapSchemafield produces aMessageElementwithout that field. Currently guarded (documenting the behavior, not endorsing it) byProtobufFileElementSchemaMapperTest.fromDataSchema_mapSchemaField_silentlyDropped.Proposed fix
Implement
map<K, V>output in the mapper (proto3 maps are modeled as a repeated nested entry message withkey/valuefields), and update the guard test to assert the emitted map field instead of its absence.