Hey Team,
I've encountered an issue in @ovotech/avro-ts@6.2.0 where it doesn't seem to support providing an instance of an Type from the avsc@5.7.7 library
Here is a minimal reproduction, I would expect the below to work based on the signature of toTypeScript
const x = toTypeScript(
avro.Type.forSchema({
type: 'record',
name: 'ExampleEvent',
fields: [
{ name: 'id', type: 'string' },
{ name: 'mobile', type: ['null', 'int'], default: null },
{ name: 'name', type: ['null', 'string'], default: null },
],
}),
);
I do have a workaround which is just to convert my avro schema to JSON then parse back to a plain ol JS object
const ts = toTypeScript(
JSON.parse(
JSON.stringify(
avro.Type.forSchema({
type: 'record',
name: 'ExampleEvent',
fields: [
{ name: 'id', type: 'string' },
{ name: 'mobile', type: ['null', 'int'], default: null },
{ name: 'name', type: ['null', 'string'], default: null },
],
}),
),
),
);
Hey Team,
I've encountered an issue in
@ovotech/avro-ts@6.2.0where it doesn't seem to support providing an instance of anTypefrom theavsc@5.7.7libraryHere is a minimal reproduction, I would expect the below to work based on the signature of
toTypeScriptI do have a workaround which is just to convert my avro schema to JSON then parse back to a plain ol JS object