swagger-codegen使用Swift 4生成的代码错误

时间:2017-11-23 10:47:24

标签: ios swift swagger swift4 swagger-codegen

我有一个新项目,其中所有REST代码都是由swagger-codegen生成的,我之前从未使用过。除了requestBuilder初始化错误之外,一切似乎都能正常工作

Cannot convert value of type 'RequestBuilder<_>.Type' to specified type 'RequestBuilder<MyGeneratedModel>.Type'

请求构建器:

let requestBuilder: RequestBuilder<TimeoutForNextRequestInSeconds>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()

requestBuilderFactory:

open static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()

AlamofireRequestBuilderFactory:

class AlamofireRequestBuilderFactory: RequestBuilderFactory {
    func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type {
        return AlamofireRequestBuilder<T>.self
    }

    func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type {
        return AlamofireDecodableRequestBuilder<T>.self
    }
}

public protocol RequestBuilderFactory {
    func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type            
    func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type
}

有什么猜测它会是什么?

0 个答案:

没有答案