-
Notifications
You must be signed in to change notification settings - Fork 115
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
Element ref not generating and linking types correctly. #130
Comments
I am also facing similar issue with XSD:
Generated GO code:
As we can see in generated code type for |
Yes. That seems to be the same issue I am encountering. |
Just convert Before After |
I have been experimenting with go-xml to see if I can use it to interface with an existing Java server application. The existing schema used by the Java code is not generating Go code as I would expect. In have cut things down to a minimal example that exhibits the problem. I can see two issues that probably have a common cause:
c4d6128
"Ensure all elements have a type" changes the code generation to use typestring
instead of structUser
(orAnon1
)c4d6128
applied theUser
element is generated as a type struct twice. Once as typeUser
and once asAnon1
. TheUlist
struct referencesUser
entries of typeAnon1
.If I change the
User
element to use a separate complexType definition then only oneUser
struct is defined andUlist
references that as I would expect.It seems like the element ref is not linking up the types correctly when generating the code.
Test files are attached but the key parts are (
testref.xsd
)<xs:element ref="my:user" minOccurs="0" maxOccurs="unbounded">
gets generated into either (
testref.go
)User []Anon1 xml:"http://example.com/public/schema/test1 user,omitempty"
or with
c4d6128
applied (testref2.go
)User []string xml:"http://example.com/public/schema/test1 user,omitempty"
If I convert to a separate complexType (
testtype.xsd
) it generates as (testtype.go
)User []Usert xml:"http://example.com/public/schema/test1 user,omitempty"
with only a single structure (named
Usert
) in the code.Test files in testdata.zip used
wsdlgen
as follows.//go:generate wsdlgen -pkg testref -r "Type$DOLLAR -> " -o testref.go testref.xsd
//go:generate wsdlgen -pkg testtype -r "Type$DOLLAR -> " -o testtype.go testtype.xsd
The text was updated successfully, but these errors were encountered: