Skip to content

bug with min and maxOccurs when group or element is referenced twice #80

@HennoVermeulen

Description

@HennoVermeulen

Describe the bug
When the same group is referenced twice with different values for minOccurs/maxOccurs, the second xsdGroup gets the minOccurs/maxOccurs values of the first reference.

A similar issue exists for two references to the same element.

Expected behavior
When there is more than one reference to the same group or element, each solved reference should have the correct minOccurs/maxOccurs values.

Library Version
1.2.19

Additional context
Example for element:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name="myElement" type="xs:string" />

    <xs:complexType name="complexType">
        <xs:sequence>
            <xs:element ref="myElement" minOccurs="1" maxOccurs="2"/>
            <xs:element name="otherElement" type="xs:string"/>
            <xs:element ref="myElement" minOccurs="3" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>

</xs:schema>

I think the solution for this is to also compare minOccurs/maxOccurs values when comparing an unsolved element with a concrete element.

I made a pull request with this solution and unit tests showing the issue: #79

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions