Good day,

I came across the following issue when generating C# classes from an Avro 
schema using the CodeGen class.
When generating code for a record having a field with the same name as the 
record, AvroGen produces a class containing a property having the same name as 
the class, which C# does not allow.

The Confluent.Apache.Avro package version used is 1.9.0.0

This is problematic when using the Avro.CodeGen class to generate Avro types at 
run-time.

How to reproduce

Invoke AvroGen on the schema below. It generates a class named "cars" 
containing a property named "cars".

{
        "type": "record",
        "name": "person",
        "namespace": "Kafka.Tests.AvroTypes",
        "fields": [
                {
                        "name": "garage",
                        "type": 
                        {
                                "type": "record",
                                "name": "cars",
                                "fields": [
                                        {
                                                "name": "cars",
                                                "type": {
                                                        "type": "array",
                                                        "items": {
                                                                "type": 
"record",
                                                                "name": "car",
                                                                "fields": [
                                                                        {
                                                                                
"name": "model",
                                                                                
"type": "string"
                                                                        },
                                                                        {
                                                                                
"name": "make",
                                                                                
"type": "string"
                                                                        }
                                                                ]
                                                        }
                                                }
                                        }
                                ]
                        }
                }
        ]
}

Best regards,

Bernhard Häussermann

Reply via email to