[Swift4]Update templates for swift 4#6921
Conversation
|
👍 |
|
@wing328 How about this PR? |
|
@d-date let me review shortly and get back to you. |
|
I'll review tomorrow morning. |
|
@wing328 I found that errors related to Codable, which is introduced on Swift4. The swift 4 pet store has little order sample models than generated ones. I’ll try to work on another issue, and fix on another PR, after merged this PR. |
|
@d-date when I ran (this error is different than the one I found in master) (I don't think it's caused by this PR but would be nice if you can look into it) |
|
@wing328 I found the reason why tests are failed. We cannot use As I read below, I have alternative as below, but I don't know how to get whether before: open class func testInlineAdditionalPropertiesWithRequestBuilder(param: Any) -> RequestBuilder<Void> {
let path = "/fake/inline-additionalProperties"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
//Compile Error: cannot convert type
...
}After: open class func testInlineAdditionalPropertiesWithRequestBuilder<T: Encodable>(param: T) -> RequestBuilder<Void> {
let path = "/fake/inline-additionalProperties"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
} |
|
already issued #6483 |
|
Please get some rest (I believe it's already late in Japan. 3am?) I'll take another look tomorrow |
…ependencies-swift
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.shand./bin/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\.3.0.0branch for changes related to OpenAPI spec 3.0. Default:master.Description of the PR
1. Updated Dependencies
Updated swift4 & 3 dependencies due to RxSwift 4.0.0 was released.
To build generated source code with
ResponseAs=RxSwiftin Swift 4, we need to build RxSwift 4.0.0 via Carthage / Cocoapods.Also, Alamofire 4.5.1 is needed for Swift 4.
In this PR, I fixed minimum version for dependencies.
2. Update syntax for Swift 4
According SE-0110: Distinguish between single-tuple and multiple-argument function types
, we need to use tuple
f(())insted off(),so when function returns
Observable<Void>type, we need to changeonNext()toonNext(()).3. Adoption for Codable
When using Codable, which is introduced on Swift4, with class inheritance, we must call
try super.init(from: decoder).