Skip to content
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

[Swift] make sure to only escape an enum if the actual final variable name is… #2516

Merged
merged 1 commit into from
May 19, 2016
Merged

Conversation

jaz-ah
Copy link
Contributor

@jaz-ah jaz-ah commented Apr 6, 2016

… going to match the enum name - now that we camelCase variable names this cuts down on the amount of enum escaping we have.

… going to match the enum name - now that we camelCase variable names this cuts down on the amount of enum escaping we have.
@wing328
Copy link
Contributor

wing328 commented Apr 10, 2016

@jaz-ah when you've time, do you mind giving an example to illustrate the issue?

@jaz-ah
Copy link
Contributor Author

jaz-ah commented Apr 11, 2016

@wing328 so for example before if we had this enum in swagger:

"Format": {
"type": "string",
"enum": ["plain","html","template"]
}

the code was generating:

public var Format: Format

which would create a swift compiler error. I made a fix to escape the enum name so we would have:

public var Format: _Format

and _Format would define the enumeration. But then we started camel casing swift variable names so without my newest fix you'd have:

public var format: _Format

but the escaping is unnecessary in this case - with this change you'll get:

public var format: Format

@jaz-ah jaz-ah changed the title make sure to only escape an enum if the actual final variable name is… [Swift] make sure to only escape an enum if the actual final variable name is… Apr 12, 2016
@jaz-ah
Copy link
Contributor Author

jaz-ah commented Apr 14, 2016

@wing328 let me know if this makes sense ^^

@wing328
Copy link
Contributor

wing328 commented Apr 14, 2016

@jaz-ah I need more time to review. We've a major PR for enum: #2508

I need to make sure enum support in other langauges do not have similar issue.

@jaz-ah
Copy link
Contributor Author

jaz-ah commented Apr 14, 2016

@wing328 no prob

@wing328 wing328 merged commit b9bbbc6 into swagger-api:master May 19, 2016
@wing328
Copy link
Contributor

wing328 commented May 19, 2016

@jaz-ah PR merged. Sorry for taking this long.

@jaz-ah jaz-ah deleted the swift/enums branch May 21, 2016 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants