-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Labels
Description
The generator available at
https://xsd-forms.herokuapp.com/
appears to look at the "pattern" but ignore "minLength" or "length" in order to decide marking a string field as mandatory (*) or optional ().
Minimal working examples:
a) The defect appears
<?xml version="1.0" encoding="utf-8" ?>
<schema xmlns:this="http://example.com/"
targetNamespace="http://example.com/"
xmlns="http://www.w3.org/2001/XMLSchema">
<simpleType name="NonEmptyString">
<restriction base="string">
<minLength value="1"/>
</restriction>
</simpleType>
<element name="nonEmptyString" type="this:NonEmptyString"/>
</schema>
b) The defect appears
<?xml version="1.0" encoding="utf-8" ?>
<schema xmlns:this="http://example.com/"
targetNamespace="http://example.com/"
xmlns="http://www.w3.org/2001/XMLSchema">
<simpleType name="NonEmptyString">
<restriction base="string">
<pattern value="[0-9A-Z]*"/>
<minLength value="1"/>
</restriction>
</simpleType>
<element name="nonEmptyString" type="this:NonEmptyString"/>
</schema>
c) The defect does not appear (i.e. it works correctly, as it should)
<?xml version="1.0" encoding="utf-8" ?>
<schema xmlns:this="http://example.com/"
targetNamespace="http://example.com/"
xmlns="http://www.w3.org/2001/XMLSchema">
<simpleType name="NonEmptyString">
<restriction base="string">
<pattern value="[0-9A-Z]+"/>
</restriction>
</simpleType>
<element name="nonEmptyString" type="this:NonEmptyString"/>
</schema>
d) The defect appears
<?xml version="1.0" encoding="utf-8" ?>
<schema xmlns:this="http://example.com/"
targetNamespace="http://example.com/"
xmlns="http://www.w3.org/2001/XMLSchema">
<simpleType name="SingleCharacter">
<restriction base="string">
<length value="1"/>
</restriction>
</simpleType>
<element name="singleCharacter" type="this:SingleCharacter"/>
</schema>
Reactions are currently unavailable