From eecd30c2dab2304b39134ebfc3e5e48e74db6ff5 Mon Sep 17 00:00:00 2001 From: Frank Lehmann <11268968+fl034@users.noreply.github.com> Date: Sat, 23 Jan 2021 03:35:37 +0100 Subject: [PATCH] [swift5] Fix target SDKs for Combine option (#8476) * Update min sdks when Combine is used * Update samples * Revert "Update min sdks when Combine is used" This reverts commit e88b8abaa787ebf8cffc6b8360ea22437ae20069. * Wrap import combine with canImport directive * Update samples * Wrap functions using Combine with canImport because of compiler error on archive * Update samples * Remove unnecessary newline and update samles --- .../src/main/resources/swift5/api.mustache | 6 +++- .../OpenAPIs/AlamofireImplementations.swift | 8 ++--- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 4 +++ .../Classes/OpenAPIs/APIs/FakeAPI.swift | 26 ++++++++++++++ .../APIs/FakeClassnameTags123API.swift | 4 +++ .../Classes/OpenAPIs/APIs/PetAPI.swift | 20 +++++++++++ .../Classes/OpenAPIs/APIs/StoreAPI.swift | 10 ++++++ .../Classes/OpenAPIs/APIs/UserAPI.swift | 18 ++++++++++ .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../default/SwaggerClientTests/Podfile.lock | 2 +- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- .../Classes/OpenAPIs/Extensions.swift | 34 +++++++++---------- .../OpenAPIs/URLSessionImplementations.swift | 6 ++-- 30 files changed, 309 insertions(+), 223 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/swift5/api.mustache b/modules/openapi-generator/src/main/resources/swift5/api.mustache index 18d3e6b30459..29fe27d9f761 100644 --- a/modules/openapi-generator/src/main/resources/swift5/api.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/api.mustache @@ -8,7 +8,9 @@ import Foundation{{#usePromiseKit}} import PromiseKit{{/usePromiseKit}}{{#useRxSwift}} import RxSwift{{/useRxSwift}}{{#useCombine}} -import Combine{{/useCombine}}{{#swiftUseApiNamespace}} +#if canImport(Combine) +import Combine +#endif{{/useCombine}}{{#swiftUseApiNamespace}} extension {{projectName}}API { {{/swiftUseApiNamespace}} @@ -143,6 +145,7 @@ extension {{projectName}}API { {{#isDeprecated}} @available(*, deprecated, message: "This operation is deprecated.") {{/isDeprecated}} + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class func {{operationId}}({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}apiResponseQueue: DispatchQueue = {{projectName}}API.apiResponseQueue) -> AnyPublisher<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error> { return Future<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}, Error>.init { promise in @@ -162,6 +165,7 @@ extension {{projectName}}API { } }.eraseToAnyPublisher() } + #endif {{/useCombine}} {{#useResult}} /** diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift index a92b70c427ba..f26fae21f710 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -9,11 +9,11 @@ import Alamofire class AlamofireRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - AlamofireRequestBuilder.self + return AlamofireRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - AlamofireDecodableRequestBuilder.self + return AlamofireDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class AlamofireRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** @@ -73,7 +73,7 @@ open class AlamofireRequestBuilder: RequestBuilder { configuration (e.g. to override the cache policy). */ open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) -> DataRequest { - manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers) + return manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers) } override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result, Error>) -> Void) { diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3c..93ed6b90b376 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index f846096ae633..62f1ed590426 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -6,7 +6,9 @@ // import Foundation +#if canImport(Combine) import Combine +#endif open class AnotherFakeAPI { /** @@ -16,6 +18,7 @@ open class AnotherFakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -29,6 +32,7 @@ open class AnotherFakeAPI { } }.eraseToAnyPublisher() } + #endif /** To test special tags diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 34fa51403b6a..b90460ea41ac 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -6,7 +6,9 @@ // import Foundation +#if canImport(Combine) import Combine +#endif open class FakeAPI { /** @@ -15,6 +17,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -28,6 +31,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** - POST /fake/outer/boolean @@ -59,6 +63,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -72,6 +77,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** - POST /fake/outer/composite @@ -103,6 +109,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -116,6 +123,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** - POST /fake/outer/number @@ -147,6 +155,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -160,6 +169,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** - POST /fake/outer/string @@ -191,6 +201,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -204,6 +215,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** - PUT /fake/body-with-file-schema @@ -236,6 +248,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -249,6 +262,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** - PUT /fake/body-with-query-params @@ -284,6 +298,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -297,6 +312,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** To test \"client\" model @@ -343,6 +359,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -356,6 +373,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -497,6 +515,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -510,6 +529,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** To test enum parameters @@ -569,6 +589,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -582,6 +603,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** Fake endpoint to test group parameters (optional) @@ -627,6 +649,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -640,6 +663,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** test inline additionalProperties @@ -673,6 +697,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -686,6 +711,7 @@ open class FakeAPI { } }.eraseToAnyPublisher() } + #endif /** test json serialization of form data diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index f6b896887ef8..42d6ea597b4b 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -6,7 +6,9 @@ // import Foundation +#if canImport(Combine) import Combine +#endif open class FakeClassnameTags123API { /** @@ -16,6 +18,7 @@ open class FakeClassnameTags123API { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -29,6 +32,7 @@ open class FakeClassnameTags123API { } }.eraseToAnyPublisher() } + #endif /** To test class name in snake case diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 01b5812ecf34..5e27397f6fd6 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -6,7 +6,9 @@ // import Foundation +#if canImport(Combine) import Combine +#endif open class PetAPI { /** @@ -16,6 +18,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -29,6 +32,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** Add a new pet to the store @@ -65,6 +69,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -78,6 +83,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** Deletes a pet @@ -126,6 +132,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher<[Pet], Error> */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[Pet], Error> { return Future<[Pet], Error>.init { promise in @@ -139,6 +146,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** Finds Pets by status @@ -179,6 +187,7 @@ open class PetAPI { - returns: AnyPublisher<[Pet], Error> */ @available(*, deprecated, message: "This operation is deprecated.") + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[Pet], Error> { return Future<[Pet], Error>.init { promise in @@ -192,6 +201,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** Finds Pets by tags @@ -232,6 +242,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -245,6 +256,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** Find pet by ID @@ -284,6 +296,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -297,6 +310,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** Update an existing pet @@ -334,6 +348,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -347,6 +362,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** Updates a pet in the store with form data @@ -395,6 +411,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -408,6 +425,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** uploads an image @@ -456,6 +474,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -469,6 +488,7 @@ open class PetAPI { } }.eraseToAnyPublisher() } + #endif /** uploads an image (required) diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index c3499823631f..b50dcb0193c8 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -6,7 +6,9 @@ // import Foundation +#if canImport(Combine) import Combine +#endif open class StoreAPI { /** @@ -16,6 +18,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -29,6 +32,7 @@ open class StoreAPI { } }.eraseToAnyPublisher() } + #endif /** Delete purchase order by ID @@ -64,6 +68,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher<[String: Int], Error> */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[String: Int], Error> { return Future<[String: Int], Error>.init { promise in @@ -77,6 +82,7 @@ open class StoreAPI { } }.eraseToAnyPublisher() } + #endif /** Returns pet inventories by status @@ -112,6 +118,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -125,6 +132,7 @@ open class StoreAPI { } }.eraseToAnyPublisher() } + #endif /** Find purchase order by ID @@ -161,6 +169,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -174,6 +183,7 @@ open class StoreAPI { } }.eraseToAnyPublisher() } + #endif /** Place an order for a pet diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 9df08496cc2d..f678057ceaf9 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -6,7 +6,9 @@ // import Foundation +#if canImport(Combine) import Combine +#endif open class UserAPI { /** @@ -16,6 +18,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -29,6 +32,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Create user @@ -62,6 +66,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -75,6 +80,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Creates list of users with given input array @@ -107,6 +113,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -120,6 +127,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Creates list of users with given input array @@ -152,6 +160,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -165,6 +174,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Delete user @@ -201,6 +211,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -214,6 +225,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Get user by user name @@ -250,6 +262,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -263,6 +276,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Logs user into the system @@ -300,6 +314,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -313,6 +328,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Logs out current logged in user session @@ -345,6 +361,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: AnyPublisher */ + #if canImport(Combine) @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher { return Future.init { promise in @@ -358,6 +375,7 @@ open class UserAPI { } }.eraseToAnyPublisher() } + #endif /** Updated user diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3c..93ed6b90b376 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d5..c7804d16e306 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3c..93ed6b90b376 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d5..c7804d16e306 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/default/SwaggerClientTests/Podfile.lock b/samples/client/petstore/swift5/default/SwaggerClientTests/Podfile.lock index a621fdeec885..11d11529e9e4 100644 --- a/samples/client/petstore/swift5/default/SwaggerClientTests/Podfile.lock +++ b/samples/client/petstore/swift5/default/SwaggerClientTests/Podfile.lock @@ -13,4 +13,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 509bec696cc1d8641751b52e4fe4bef04ac4542c -COCOAPODS: 1.9.0 +COCOAPODS: 1.10.0 diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3c..93ed6b90b376 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d5..c7804d16e306 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Extensions.swift index a6a3cf54df1e..e5511b3aa373 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index c9bd304a6de2..a2de4751c64d 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ internal class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ internal func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3c..93ed6b90b376 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d5..c7804d16e306 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 31bfaa0255f8..736702ea5dd9 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -8,35 +8,35 @@ import Foundation import PromiseKit extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -49,7 +49,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -65,32 +65,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -98,11 +98,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -175,7 +175,7 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d5..c7804d16e306 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3c..93ed6b90b376 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d5..c7804d16e306 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3c..93ed6b90b376 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d5..c7804d16e306 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3c..93ed6b90b376 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d5..c7804d16e306 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /** diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift index 2c8638c35c3c..93ed6b90b376 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -7,35 +7,35 @@ import Foundation extension Bool: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Float: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension Int32: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int32) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } } extension Int64: JSONEncodable { - func encodeToJSON() -> Any { NSNumber(value: self as Int64) } + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } } extension Double: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension String: JSONEncodable { - func encodeToJSON() -> Any { self as Any } + func encodeToJSON() -> Any { return self as Any } } extension RawRepresentable where RawValue: JSONEncodable { - func encodeToJSON() -> Any { self.rawValue as Any } + func encodeToJSON() -> Any { return self.rawValue as Any } } private func encodeIfPossible(_ object: T) -> Any { @@ -48,7 +48,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - self.map(encodeIfPossible) + return self.map(encodeIfPossible) } } @@ -64,32 +64,32 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - self.base64EncodedString(options: Data.Base64EncodingOptions()) + return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } extension Date: JSONEncodable { func encodeToJSON() -> Any { - CodableHelper.dateFormatter.string(from: self) as Any + return CodableHelper.dateFormatter.string(from: self) as Any } } extension URL: JSONEncodable { func encodeToJSON() -> Any { - self + return self } } extension UUID: JSONEncodable { func encodeToJSON() -> Any { - uuidString + return self.uuidString } } extension String: CodingKey { public var stringValue: String { - self + return self } public init?(stringValue: String) { @@ -97,11 +97,11 @@ extension String: CodingKey { } public var intValue: Int? { - nil + return nil } public init?(intValue: Int) { - nil + return nil } } @@ -174,6 +174,6 @@ extension KeyedDecodingContainerProtocol { extension HTTPURLResponse { var isStatusCodeSuccessful: Bool { - Array(200 ..< 300).contains(statusCode) + return Array(200 ..< 300).contains(statusCode) } } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index beb8609855d5..c7804d16e306 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -11,11 +11,11 @@ import MobileCoreServices class URLSessionRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { - URLSessionRequestBuilder.self + return URLSessionRequestBuilder.self } func getBuilder() -> RequestBuilder.Type { - URLSessionDecodableRequestBuilder.self + return URLSessionDecodableRequestBuilder.self } } @@ -65,7 +65,7 @@ open class URLSessionRequestBuilder: RequestBuilder { the file extension). Return the desired Content-Type otherwise. */ open func contentTypeForFormPart(fileURL: URL) -> String? { - nil + return nil } /**