MinLength and MaxLenght merged to Length attribute
Description of the bug
Given following xml
<xs:simpleType seres:elementtype="Tegnrestriksjon" seres:guid="http://seres.no/guid/Finanstilsynet/Tegnrestriksjon/RestriksjonLEICodeType/621535" name="LEICodeType_S3_RestriksjonLEICodeType">
<xs:restriction base="xs:string">
<xs:minLength value="20" />
<xs:maxLength value="20" />
<xs:pattern value="([0-9a-zA-Z]{18}[0-9]{2})" />
</xs:restriction>
</xs:simpleType>
When converted to json schema and back to xsd minLenght and MaxLenght attributes merges to length:
<xs:simpleType seres:elementtype="Tegnrestriksjon" seres:guid="http://seres.no/guid/Finanstilsynet/Tegnrestriksjon/RestriksjonLEICodeType/621535" name="LEICodeType_S3_RestriksjonLEICodeType">
<xs:restriction base="xs:string">
<xs:length value="20" />
<xs:pattern value="([0-9a-zA-Z]{18}[0-9]{2})" />
</xs:restriction>
</xs:simpleType>
Affected files
4710-45001.xsd 4765-44992.xsd
Steps To Reproduce
Run the test DataModeling.Tests.Seres2JsonSchema2SeresTests.ConvertSeresXsd_SeresGeneratedXsd_ShouldConvertToJsonSchemaAndBackToXsd with the files mentioned Above.
Console application on branch feature/datamodelling-console can reproduce the issue as well.
Additional Information
No response
@RonnyB71 I'm not sure if we should work on this task since those schemas are equivalent. What we might should do, is actually making our XmlSchemaAssertions class, used in tests, resilient to those differences. cc @nkylstad
@mirkoSekulic Does this merge only happen because minLength and maxLength have the same value? So that where these values are different, the original properties / restrictions are maintained.
@KurtStian correct. The merge happens only if the minLength and maxLength have the same value.
Not critical at this point. Validates the same data.