AdrianStrugala / AvroConvert

Rapid Avro serializer for C# .NET
Other
102 stars 27 forks source link

Improve GenerateModel() #2 #62

Closed steinbohrer closed 3 years ago

steinbohrer commented 3 years ago

Hi,

thank you for fixing the bugs/improvements I posted this quick.

I just did a quick check on GenerateModel() and it does not work as intended.

Taking the Avro schema from issue #58 the output is:

public class Result
{
    public module module { get; set; }
    public customerInfo customerInfo { get; set; }
    public string deviceId { get; set; }
    public string url { get; set; }
}

public class module
{
    public string? moduleIdName { get; set; }
    public module[] data { get; set; }    <=== This should be: "public datamodule[] data { get; set; }"
    public int? instrumentId { get; set; }
}

public class datamodule
{
    public bool? isControl { get; set; }
}

public class customerInfo
{
    public string country { get; set; }
    public string customerNumber { get; set; }
}

The namespace "data" is defined in "name": "data", so it should be applied to the name of the subclass and the field member which referrs to that subclass.

AdrianStrugala commented 3 years ago

Hello,

Thanks for checking the improvement. The problem was caused by improper handling of the array type field. It should be solved now. Please check version 3.2.2.

Please confirm if it works as expected. Regards, Adrian

steinbohrer commented 3 years ago

Hi,

I've tested the new version with all Avro schemas I have access to and it now seems to work. Thanks for fixing this.