-
-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
Description
Having an element with a type of the same name as the element breaks generation.
Interestingly it is not a problem, if the complexType is defined in the .xsd before the usage of the type.
Steps to reproduce the issue:
Notice i have added this line to the test xsd: <element name="MyType7" type="here:MyType7"></element>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:here="http://example.org/"
targetNamespace="http://example.org/">
<element name="MyType7" type="here:MyType7"></element>
<simpleType name="myType1">
<restriction base="base64Binary">
<length value="10" />
</restriction>
</simpleType>
<complexType name="myType2">
<simpleContent>
<extension base="base64Binary">
<attribute name="length" type="int" />
</extension>
</simpleContent>
</complexType>
<complexType name="myType3">
<simpleContent>
<extension base="date">
<attribute name="length" type="int" />
</extension>
</simpleContent>
</complexType>
<complexType name="myType4">
<sequence>
<element name="title" type="string" />
<element name="blob" type="base64Binary" />
<element name="timestamp" type="dateTime" />
</sequence>
</complexType>
<simpleType name="myType5">
<restriction base="gDay" />
</simpleType>
<complexType name="MyType6">
<attribute name="code">
<simpleType>
<restriction base="string">
<enumeration value="value1" />
<enumeration value="value2" />
</restriction>
</simpleType>
</attribute>
<attribute name="identifier" type="int" />
</complexType>
<complexType name="MyType7">
<simpleContent>
<extension base="string">
<attribute type="string" name="origin" use="required" />
</extension>
</simpleContent>
</complexType>
<element name="TopLevel">
<complexType>
<complexContent>
<extension base="here:MyType6">
<sequence>
<element name="nested" type="here:MyType7" minOccurs="0" maxOccurs="1" />
<choice minOccurs="0" maxOccurs="unbounded">
<element name="myType1" type="here:myType1" />
<element name="myType2" type="here:myType2" />
</choice>
</sequence>
<attribute name="cost" type="double" />
<attribute name="LastUpdated" type="dateTime" />
</extension>
</complexContent>
</complexType>
</element>
</schema>
Describe the results you received:
Go structs are not generated
Describe the results you expected:
Go structs should be generated
Output of go version:
go version go1.24.2 darwin/arm64
xgen version or commit ID:
d9d0ba0e21ddfb95ded66c033276c4c066e08a34
Environment details (OS, physical, etc.):
Metadata
Metadata
Assignees
Labels
No labels