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

Avoid generating generic and error types for attributes with other valid types #284

Closed
tefra opened this issue Oct 7, 2020 · 0 comments
Closed

Comments

@tefra
Copy link
Owner

tefra commented Oct 7, 2020

The type object and str shouldn't be generated

    <xs:element name="Example">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="x" type="xs:anyType" maxOccurs="unbounded">
                    <xs:alternative test="@kind = 'quantity'">
                        <xs:complexType>
                            <xs:simpleContent>
                                <xs:extension base="xs:int">
                                    <xs:attribute ref="kind" use="required"/>
                                </xs:extension>
                            </xs:simpleContent>
                        </xs:complexType>
                    </xs:alternative>
                    <xs:alternative test="@kind = 'price'">
                        <xs:complexType>
                            <xs:simpleContent>
                                <xs:extension base="xs:double">
                                    <xs:attribute ref="kind" use="required"/>
                                </xs:extension>
                            </xs:simpleContent>
                        </xs:complexType>
                    </xs:alternative>
                    <xs:alternative test="@kind = 'mesg'">
                        <xs:complexType>
                            <xs:simpleContent>
                                <xs:extension base="xs:string">
                                    <xs:attribute ref="kind" use="required"/>
                                </xs:extension>
                            </xs:simpleContent>
                        </xs:complexType>
                    </xs:alternative>
                    <xs:alternative type="xs:error"/>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
 x: List[Union[object, str, "Example.KindQuantity", "Example.KindPrice", "Example.KindMesg"]] = field(
        default_factory=list,
        metadata=dict(
            type="Element",
            namespace="",
            min_occurs=1,
            max_occurs=9223372036854775807
        )
    )
tefra added a commit to tefra/xsdata-w3c-tests that referenced this issue Oct 7, 2020
@tefra tefra closed this as completed in 3d59be5 Oct 8, 2020
tefra added a commit to tefra/xsdata-w3c-tests that referenced this issue Oct 8, 2020
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

No branches or pull requests

1 participant