go-xml
go-xml copied to clipboard
Only flatten a type once
This should resolve issue https://github.com/droyo/go-xml/issues/86
Thank you for opening this. Are you sure this resolves #86 ? #86 happens during parsing within the xsd package, but your change is to the xsdgen package. I have a unit test reproduction in the recursive-types branch.
Instead this looks more like a performance optimization. Does this change the xsdgen output at all?
It solved an infinity loop problem that had when running xsdgen!
But… it generated invalid recursive types
@droyo Sorry in my haste to go to have a holiday I miss read the 86 ticket I will fix this once I figure out the error @t0rr3sp3dr0 is having.
@t0rr3sp3dr0 Could you maybe provided me with the xsd that you used where you noticed the invalid types that are generated? Thanks in advance
Sure @boekkooi-fresh! I was trying to generate models for SAML. They are all packed together at https://docs.oasis-open.org/security/saml/v2.0/saml-2.0-os-xsd.zip. I’ve solved the problem by converting all fields that had omitempty tag to pointers.
PS: I also had to change encoding for one document, it was US-ASCII and it just worked when changed it to UTF-8. I don’t know if it is a known problem of the tool, but I can assure you the files are well-formed as I’ve generated Java classes for it using xjc.
PS2: To make it simpler for you, disconsider all saml-schema-authn-* files. Unfortunately you’ll still have to download some dependencies such as xmlenc.