gowsdl icon indicating copy to clipboard operation
gowsdl copied to clipboard

Fixing reserved word mapping for 'int' in attribute fields

Open borderss opened this issue 6 months ago • 0 comments

This fixes an issue described in https://github.com/hooklift/gowsdl/issues/275

For example, in such a situation:

<xs:complexType name="ArrayOfint">
	<xs:sequence>
		<xs:element minOccurs="0" maxOccurs="unbounded" name="int" type="xs:int"/>
	</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfint" nillable="true" type="tns:ArrayOfint"/>
<xs:complexType name="ArrayOfstring">
	<xs:sequence>
		<xs:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="xs:string"/>
	</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfstring" nillable="true" type="tns:ArrayOfstring"/>

the complex types are generated to such structs:

type ArrayOfint struct {
	int []int32 `xml:"int,omitempty" json:"int,omitempty"` // int is a reserved word, should be `Aint` instead
}

type ArrayOfstring struct {
	Astring []*string `xml:"string,omitempty" json:"string,omitempty"`
}

borderss avatar Aug 19 '25 09:08 borderss