-
Notifications
You must be signed in to change notification settings - Fork 162
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
Handle enumeration better #83
Comments
I like your suggestion but it's probably better to keep the type exported (e.g. Country) to allow people to set values when they know what they're doing. The problem of introducing new functions and types in the generated code is all the burden of insuring unique names etc. |
Also I'm surprised that this is being generated with unexpected symbol - might have been my mistake in the last patches when I changed trimns/goSymbol. |
We can probably close this then. |
A small annoyance that I found today. It revolves around enumeration, and how to work with them.
Take the following wsdl snippet:
This gets translated to:
The problem is
type country string
- as the type starts with lowercase, you effectively cannot access that type outside the package the bindings are generated in (which is especially sour if you need that enumeration for requests).Now, one could of course simple make it start with uppercase just like all the other types. However, that seems unsafe, as we already have a validate method.
What I have in mind instead is something likeNewCountry(input string)
, which would take a string (or the equivalent type of the enumeration), instantiate a new instance, run validate, and then return the instance or an error.Edit: I just realize that this a bad idea, since this method would still return an unexported type - which is deemed bad style. So instead - how about title casing them like the other types, but also providing constants of sorts, so they could be used directly without instantiating?
Thoughts?
The text was updated successfully, but these errors were encountered: