-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
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 },
],
}),
),
),
);Metadata
Metadata
Assignees
Labels
No labels