Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify some types of union #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SoMuchForSubtlety
Copy link

This is a companion PR to #140

Unions that consist of basic types and complex types based on the same basic type can be replaced with just the basic type.

This:

<xs:element name="Type1">
    <xs:complexType>
        <xs:sequence minOccurs="1" maxOccurs="1">
            <xs:element name="Elem" type="redundantUnionType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:simpleType name="enumType">
    <xs:restriction base="xs:string">
        <xs:enumeration value="A"/>
        <xs:enumeration value="B"/>
        <xs:enumeration value="C"/>
    </xs:restriction>
</xs:simpleType>

<xs:simpleType name="redundantUnionType">
    <xs:union memberTypes="enumType xs:string"/>
</xs:simpleType>

can be simplified to:

<xs:element name="Type1">
    <xs:complexType>
        <xs:sequence minOccurs="1" maxOccurs="1">
            <xs:element name="Elem" type="enumType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:simpleType name="enumType">
    <xs:restriction base="xs:string">
        <xs:enumeration value="A"/>
        <xs:enumeration value="B"/>
        <xs:enumeration value="C"/>
    </xs:restriction>
</xs:simpleType>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant