-
Notifications
You must be signed in to change notification settings - Fork 6k
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 code generator produces code with compile warnings #4098
Comments
David I don't see these on the latest swift3 implementation - are you using that one or the older swift2 version? |
Using the current swift2 implementation; we can't quite upgrade to swift3 yet. |
if you'd like to submit a PR to that, it sounds like a reasonable answer... |
@davebaird let us know if you need help with the PR. |
@wing328 I'd like to obsolete any < Swift3 issues at this point so we can focus on Swift3/4 |
@jaz-ah totally agree it has been almost a year when Swift3 was released: https://swift.org/blog/swift-3-0-released/ and we should definitely concentrate our efforts on Swift 3.x, 4.x I'll update the help text for |
Sounds good |
UPDATE:
|
Description
The code generated by Swagger-codegen for Swift will produce a file, AlamofireImplementations.swift, which will have a number of compile warnings, all of them the same:
There are a few different places that cause this, but here's an example:
where the warning is on "as!". Seems like an optional cast (as?) would fix these.
Swagger-codegen version
Using version 2.2.2-SNAPSHOT on master.
Swagger declaration file content or url
I don't have a swagger file to post here, because I can see already that this is invariant to the swagger declaration file. The file in question is mostly pre-defined as is in the template: https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/swift/AlamofireImplementations.mustache
The warnings come on lines 172, 187, and 197.
Command line used for generation
This is run from gradle with a custom task I wrote in groovy to call the DefaultGenerator. Again, I don't believe this makes any difference.
Steps to reproduce
Generate a client library for swift and then try to compile that swift.
Related issues
My searched turned up no related issues.
Suggest a Fix
I think optional casts in the template file in question would fix it.
The text was updated successfully, but these errors were encountered: