Json2CSharp / Json2CSharpCodeGenerator

Microsoft Reciprocal License
305 stars 83 forks source link

Duplicated Classes Issue #20

Closed Json2CSharp closed 3 years ago

Json2CSharp commented 3 years ago

If the same object is repeated elsewhere a new class is created -> bug TEST CASE # 7,

Example:

{ "testobject":[ { "testprop":"test", "testprop2":"test2" }, { "testprop":"test", "testprop2":"test2" } ], "testparent":{ "testobject":[ { "testprop":"test", "testprop2":"test2" }, { "testprop":"test", "testprop2":"test2" } ] } }

Should return

public class Root
{
    public List<Testobject> Testobject { get; set; }
    public Testparent Testparent { get; set; }
}

public class Testobject
{
    public string Testprop { get; set; }
    public string Testprop2 { get; set; }
}

public class Testparent
{
    public List<Testobject> Testobject { get; set; }
}
Json2CSharp commented 3 years ago

d0118bdd04900564d3eb4a359880d0dee863164d