gowsdl
gowsdl copied to clipboard
Handling plus (and probably some other characters) in enumerations
This type
<xsd:simpleType name="SomeTypeName">
<!-- omitted -->
<xsd:restriction base="xsd:string">
<xsd:enumeration value="FOO"/>
<xsd:enumeration value="FOO2"/>
<xsd:enumeration value="FOO2+"/>
</xsd:restriction>
</xsd:simpleType>
is being generated to
type SomeTypeName string
const (
SomeTypeNameFOO SomeTypeName = "FOO"
SomeTypeNameFOO2 SomeTypeName = "FOO2"
SomeTypeNameFOO2 SomeTypeName = "FOO2+"
)
which is a duplicated identifier
The closest previously reported bug I could find is https://github.com/hooklift/gowsdl/issues/16
I agree that my suggestion is very problem-specific and does not solve to problem in general.
After thinking some more I think that the better solution would be to implement a way to provide an external map of the names that cannot be mangled automatically.
Like a separate json file that would look like:
{
"SomeTypeName": {
"FOO2+": "Foo2Plus"
}
}
And then used as wsdl --custom-map=/path/to/file.json
It's not necessary to be json
but any serialisation format that would guarantee that all possible wsdl
type names are decoded in an unambiguous manner.
I like the idea of custom map because xml is such a problematic format. We will never handle all the cases to generate valid go code 😆