mganss / XmlSchemaClassGenerator

Generate C# classes from XML Schema files
Apache License 2.0
603 stars 180 forks source link

Incorrect transnlation RangeAttribute(decimal) #513

Closed egiorgioPatagonian closed 5 months ago

egiorgioPatagonian commented 5 months ago

Hi there! I detected bad translation of that file SpotLength is assigned type uint but the RangeAttribute is decimal. RangeAttribute here should be uint

 /// <summary>
/// <para>Overall duration of commercial material for each spot on this buyline in seconds.  (e.g. for two :15s bookends, the spot length must be set to 30)</para>
/// <para>Duration of spot in seconds from 1s to 23h:59m:59s.</para>
/// <para xml:lang="en">Maximum inclusive value: 86399.</para>
/// <para xml:lang="en">Minimum inclusive value: 1.</para>
/// </summary>
[System.ComponentModel.DescriptionAttribute("Overall duration of commercial material for each spot on this buyline in seconds." +
    " (e.g. for two :15s bookends, the spot length must be set to 30)")]
[System.ComponentModel.DataAnnotations.RangeAttribute(**typeof(decimal), "1", "86399"**)]
[System.ComponentModel.DataAnnotations.RequiredAttribute(AllowEmptyStrings=true)]
[System.Xml.Serialization.XmlElementAttribute("SpotLength")]
public uint SpotLength { get; set; }

Command: xscgen -n "a.xsd=Example.NamespaceA" .\TVB_OrderCommon_3.2.xsd --collectionSettersMode=Public --nullable

TVB_MediaCommon_3.2.zip

Can this be considered a bug?

mganss commented 5 months ago

You're right, the type for RangeAttribute should match the property's type.

mganss commented 5 months ago

Fixed in 2.1.1144.

egiorgioPatagonian commented 5 months ago

Thanks @mganss