fsprojects / pulsar-client-dotnet

Apache Pulsar native client for .NET (C#/F#/VB)
MIT License
301 stars 47 forks source link

Schema with same class, record or enum for different fields throws error #246

Open RufusK opened 9 months ago

RufusK commented 9 months ago

Hi, we have a bug, that (at least for enums) we thought was fixed. If we use the same class, enum or record in different fields of a message like this:

` public class OrderMessage { public Address Address1 {get; set;} public Address Address2 {get; set;} }

public class Address { public string Street {get; set;} } `

then we get the following error when trying to produce a message:

System.Exception: Can not resolve JsonSchema 'type' id of "record", not recognized as one of standard values: [STRING, NUMBER, INTEGER, BOOLEAN, OBJECT, ARRAY, NULL, ANY] at <StartupCode$Pulsar-Client>.$ProducerImpl.-ctor@480-55.MoveNext() at <StartupCode$Pulsar-Client>.$ProducerImpl.InitInternal@785.MoveNext() at <StartupCode$Pulsar-Client>.$ProducerImpl.Init@793.MoveNext() at <StartupCode$Pulsar-Client>.$PulsarClient.CreateProducerAsync@262.MoveNext()

There has been a similar issue: https://github.com/fsprojects/pulsar-client-dotnet/issues/201 that was originally fixed by a coworker. We are wondering what can cause this to be back.

We use Pulsar Server Version 2.9.2; pulsar-client-dotnet 2.15.0

Thanks in advance

Lanayx commented 9 months ago

Hi, @RufusK ! First, I don't see that this issue relates to the previous in any way. Second, schema generation is handled by separate library (https://github.com/eaba/AvroSchemaGenerator), so please check it's generated output for your case and create issue there if something is wrong with it.

UPDATE: found something related https://github.com/apache/pulsar/issues/6768