MSGraph-SDK-Code-Generator icon indicating copy to clipboard operation
MSGraph-SDK-Code-Generator copied to clipboard

DerivedTypeConverter incorrectly applied

Open MIchaelMainer opened this issue 6 years ago • 0 comments

https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator/blob/dev/Templates/CSharp/Model/ComplexType.cs.tt#L44

if (complex.Derived != null && complex.Base == null)
{
    attributeStringBuilder.Append(Environment.NewLine);
    attributeStringBuilder.Append("    ");
    attributeStringBuilder.Append("[JsonConverter(typeof(DerivedTypeConverter))]");
}

complex.Derived is never null as far as I've observed. It can be an empty list. We should change this check to complex.Derived?.Count > 0 AB#7081

MIchaelMainer avatar Feb 28 '20 19:02 MIchaelMainer