swagger-codegen
swagger-codegen copied to clipboard
[Swift] Ensure that enumeration types do not conflict with variable name
Swagger generator: 2.1.5 Language: swift
(This is w/ Swift 2 on XCode7.2)
If we have a swagger specification like this:
https://gist.github.com/jaz-ah/f6394360065650000c96
The generated code produced is:
public enum EnumTest: String {
case Abc = "abc"
case Def = "def"
}
public var EnumTest: EnumTest?
which produces a complier error:
'EnumTest' used within its own type
We need to protect against this condition by ensuring our enumeration name always is different than the variable name.