confluent-schema-registry
confluent-schema-registry copied to clipboard
Avro: UnionTypes not supported by lib but supported by the confluent registry
It seems that union types are not supported by this lib, since the validation assumes that the type has a name.
The confluent registry however accepts union types just fine. They also have test cases for the KafkaAvroSerializer testing union support: https://github.com/confluentinc/schema-registry/blob/master/avro-serializer/src/test/java/io/confluent/kafka/serializers/KafkaAvroSerializerTest.java#L440
Currently, i bumped into the following spots with the union schema:
- readAVSC - https://github.com/kafkajs/confluent-schema-registry/blob/master/src/utils/readAVSC.ts#L11
- AvroHelper.validate: https://github.com/kafkajs/confluent-schema-registry/blob/master/src/AvroHelper.ts#L25
It looks like that the subject naming strategy is limited to "TopicNameStrategy" when using union types, which forced me to wrap the union in a record with a single field.