Problem description
Given this XSD:
<xs:simpleType name="BitmapWeek">
<xs:restriction base="xs:string">
<xs:minLength value="7"/>
<xs:maxLength value="7"/>
<xs:pattern value="[0-1]{7}"/>
</xs:restriction>
</xs:simpleType>
The generator produces:
[XmlIgnore]
private List<string> _weeklyPattern;
[XmlElement("WeeklyPattern", Order = 3)]
public List<string> WeeklyPattern
{
get => _weeklyPattern;
set => _weeklyPattern = value;
}
[XmlIgnore]
public bool WeeklyPatternSpecified =>
WeeklyPattern != null && WeeklyPattern.Count != 0;
This is incorrect.
BitmapWeek is a simple string type, not a list.
Expected output
The generator should produce:
[MinLength(7)]
[MaxLength(7)]
[RegularExpression("[0-1]{7}")]
[XmlElement("WeeklyPattern", Order = 3)]
public string WeeklyPattern { get; set; }
Why this is a bug
The generator behaves correctly when the simpleType is inline inside an element, e.g.:
<xs:element name="BitmapDays">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="740"/>
<xs:pattern value="[0-1]{1,740}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
This produces the correct C#:
[MinLength(1)]
[MaxLength(740)]
[RegularExpression("[0-1]{1,740}")]
[XmlElement("BitmapDays", Order = 0)]
public string BitmapDays { get; set; }
Seems like there is a problem with named simple types.
Would be nice if there is a fix for that. Currently I manually change the generated file because I can't change the xsd.
Problem description
Given this XSD:
The generator produces:
This is incorrect.
BitmapWeek is a simple string type, not a list.
Expected output
The generator should produce:
Why this is a bug
The generator behaves correctly when the simpleType is inline inside an element, e.g.:
This produces the correct C#:
Seems like there is a problem with named simple types.
Would be nice if there is a fix for that. Currently I manually change the generated file because I can't change the xsd.