Expected behavior
When a class has ShouldSerialize{PropName}() returning false, the WSDL should generate that element with minOccurs="0" (like XmlSerializer does).
Actual behavior
The element always has minOccurs="1", ignoring the ShouldSerialize method.
Minimal reproduction
public class MyRequest
{
public int? OptionalValue { get; set; }
public bool ShouldSerializeOptionalValue() => OptionalValue.HasValue;
}
Generated WSDL excerpt:
<xs:element name="OptionalValue" type="xs:int" minOccurs="1" .../>
Expected WSDL excerpt:
<xs:element name="OptionalValue" type="xs:int" minOccurs="0" .../>
Expected behavior
When a class has
ShouldSerialize{PropName}()returningfalse, the WSDL should generate that element withminOccurs="0"(like XmlSerializer does).Actual behavior
The element always has
minOccurs="1", ignoring theShouldSerializemethod.Minimal reproduction
Generated WSDL excerpt:
Expected WSDL excerpt: