From to the README of avro-ts
Avro Ts attempts to generate the types of the "auto" setting for wrapped unions.
It does this with the following simple logic on these lines of code:
|
export const isWrappedUnion = (type: Schema, context: Context): type is WrappedUnionItem[] => |
|
isUnion(type) && |
|
type.filter((item) => item !== 'null').length > 1 && |
|
type.filter((item) => item !== 'null').every((item) => isRecordType(resolveItem(context, item))); |
But avsc seem to have a more complex approach as seen here. More specifically in the isAmbiguous() function.
This sometimes leads to failure when trying to encode such message from the types generated by avro-ts