diff --git a/samples/client/petstore/swift5/alamofireLibrary/Package.swift b/samples/client/petstore/swift5/alamofireLibrary/Package.swift index 6e820c6971b02d779ba3498beaadddfe04e7e2ad..9371b3d57bd4f7d6863571273a617917264e915f 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/Package.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/Package.swift @@ -14,19 +14,19 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "PetstoreClient", - targets: ["PetstoreClient"]), + targets: ["PetstoreClient"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.9.1"), + .package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.9.1") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "PetstoreClient", - dependencies: ["Alamofire", ], + dependencies: ["Alamofire" ], path: "PetstoreClient/Classes" - ), + ) ] ) diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 2404bc8ffc6d6a190b82327193d4b5b2325dd515..5b09f9557113d4bc4d0ca8b0b05b4f408008c2ff 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,7 +7,7 @@ import Foundation public struct APIHelper { - public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,17 +20,17 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? Array<Any?> { - result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" } } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { guard let source = source else { return nil } @@ -46,15 +46,15 @@ public struct APIHelper { } public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? Array<Any?> { + if let collection = source as? [Any?] { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? Array<Any?> { + if let collection = item.value as? [Any?] { collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in result.append(URLQueryItem(name: item.key, value: value)) } @@ -69,4 +69,3 @@ public struct APIHelper { return destination } } - diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index 69e723d482f53bacdc87b93ac6a50808ccde7b6a..224d1fc911b6051f60a688ce24e5deebc07e2db2 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,23 +9,23 @@ import Foundation open class PetstoreClientAPI { public static var basePath = "http://petstore.swagger.io:80/v2" public static var credential: URLCredential? - public static var customHeaders: [String:String] = [:] + public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder<T> { var credential: URLCredential? - var headers: [String:String] - public let parameters: [String:Any]? + var headers: [String: String] + public let parameters: [String: Any]? public let isBody: Bool public let method: String public let URLString: String /// Optional block to obtain a reference to the request's progress instance when available. - public var onProgressReady: ((Progress) -> ())? + public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -35,7 +35,7 @@ open class RequestBuilder<T> { addHeaders(PetstoreClientAPI.customHeaders) } - open func addHeaders(_ aHeaders:[String:String]) { + open func addHeaders(_ aHeaders: [String: String]) { for (header, value) in aHeaders { headers[header] = value } @@ -58,5 +58,5 @@ open class RequestBuilder<T> { public protocol RequestBuilderFactory { func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index bb3ae717825412b9adeed7bb5ddda32ea74185ec..5bbf323f820cd3132cf60e1d11dbf21e55944156 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class AnotherFakeAPI { /** To test special tags @@ -17,7 +15,7 @@ open class AnotherFakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index d1d81faa335c4ea18856b16a52b2ee7cc0054f3a..134d6aea416a97039b668ee963e2c53f0df2d6d3 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class FakeAPI { /** @@ -16,7 +14,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?,_ error: Error?) -> Void)) { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) { fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -51,7 +49,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) { fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -86,7 +84,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?,_ error: Error?) -> Void)) { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) { fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -121,7 +119,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -156,7 +154,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -192,7 +190,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -231,7 +229,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -281,7 +279,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -318,7 +316,7 @@ open class FakeAPI { open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), @@ -337,7 +335,7 @@ open class FakeAPI { let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -426,7 +424,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -454,19 +452,19 @@ open class FakeAPI { open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "enum_form_string_array": enumFormStringArray?.encodeToJSON(), "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), - "enum_query_string": enumQueryString?.encodeToJSON(), - "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -492,7 +490,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -518,13 +516,13 @@ open class FakeAPI { open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": requiredStringGroup.encodeToJSON(), - "required_int64_group": requiredInt64Group.encodeToJSON(), - "string_group": stringGroup?.encodeToJSON(), + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -545,7 +543,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testInlineAdditionalProperties(param: [String:String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -562,7 +560,7 @@ open class FakeAPI { - parameter param: (body) request body - returns: RequestBuilder<Void> */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> { let path = "/fake/inline-additionalProperties" let URLString = PetstoreClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) @@ -582,7 +580,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -603,14 +601,14 @@ open class FakeAPI { open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "param": param.encodeToJSON(), "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index d21c4a49d43d099eaa7ffc901ca9ff1884235915..48cfe7187b9a6740385db65efbbdef7fb6164a7f 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -7,8 +7,6 @@ import Foundation - - open class FakeClassnameTags123API { /** To test class name in snake case @@ -17,7 +15,7 @@ open class FakeClassnameTags123API { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index f5366f5832baf471018f15f4d04882347e77df85..c938db7200472ab06b8c2f0a29c7660aec7cb118 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class PetAPI { /** Add a new pet to the store @@ -17,7 +15,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -57,7 +55,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -84,8 +82,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ "api_key": apiKey?.encodeToJSON() @@ -113,7 +111,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -137,8 +135,8 @@ open class PetAPI { open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "status": status.encodeToJSON() @@ -157,7 +155,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -182,8 +180,8 @@ open class PetAPI { open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "tags": tags.encodeToJSON() @@ -201,7 +199,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?,_ error: Error?) -> Void)) { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) { getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,8 +226,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -244,7 +242,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -285,7 +283,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -313,14 +311,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "name": name?.encodeToJSON(), "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -337,7 +335,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -365,14 +363,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -389,7 +387,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -417,14 +415,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 3848eda85ad69cbca414345076b6c6a1eeea6bc3..a8a83eda39a4e7ee3a7cc86e3ce0d0bc26e7182c 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class StoreAPI { /** Delete purchase order by ID @@ -17,7 +15,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -41,8 +39,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -56,7 +54,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String:Int]?,_ error: Error?) -> Void)) { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) { getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -76,14 +74,14 @@ open class StoreAPI { - name: api_key - returns: RequestBuilder<[String:Int]> */ - open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { let path = "/store/inventory" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } @@ -95,7 +93,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -119,8 +117,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -135,7 +133,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 546166841d9e6987c83402f734038868be6c3997..505ed1b0c5c9995b0bc45aa233212d11a8e515e9 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class UserAPI { /** Create user @@ -17,7 +15,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -54,7 +52,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -90,7 +88,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -126,7 +124,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -150,8 +148,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -166,7 +164,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?,_ error: Error?) -> Void)) { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) { getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -189,8 +187,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -206,7 +204,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,11 +226,11 @@ open class UserAPI { open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username.encodeToJSON(), + "username": username.encodeToJSON(), "password": password.encodeToJSON() ]) @@ -247,7 +245,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -266,8 +264,8 @@ open class UserAPI { open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -283,7 +281,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: 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 e7320f28ec57110520678f7e99f8a0721c8fca67..368b4edffb9321e57ab40acd57c051184573398a 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -12,7 +12,7 @@ class AlamofireRequestBuilderFactory: RequestBuilderFactory { return AlamofireRequestBuilder<T>.self } - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type { + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { return AlamofireDecodableRequestBuilder<T>.self } } @@ -21,7 +21,7 @@ class AlamofireRequestBuilderFactory: RequestBuilderFactory { private var managerStore = SynchronizedDictionary<String, Alamofire.SessionManager>() open class AlamofireRequestBuilder<T>: RequestBuilder<T> { - required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } @@ -59,17 +59,17 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> { May be overridden by a subclass if you want to control the request configuration (e.g. to override the cache policy). */ - open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) -> DataRequest { + open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) -> DataRequest { 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<Response<T>, Error>) -> Void) { - let managerId:String = UUID().uuidString + let managerId: String = UUID().uuidString // Create a new manager for each request to customize its request header let manager = createSessionManager() managerStore[managerId] = manager - let encoding:ParameterEncoding = isBody ? JSONDataEncoding() : URLEncoding() + let encoding: ParameterEncoding = isBody ? JSONDataEncoding() : URLEncoding() let xMethod = Alamofire.HTTPMethod(rawValue: method) let fileKeys = parameters == nil ? [] : parameters!.filter { $1 is NSURL } @@ -82,8 +82,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> { case let fileURL as URL: if let mimeType = self.contentTypeForFormPart(fileURL: fileURL) { mpForm.append(fileURL, withName: k, fileName: fileURL.lastPathComponent, mimeType: mimeType) - } - else { + } else { mpForm.append(fileURL, withName: k) } case let string as String: @@ -102,7 +101,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> { } self.processRequest(request: upload, managerId, apiResponseQueue, completion) case .failure(let encodingError): - apiResponseQueue.async{ + apiResponseQueue.async { completion(.failure(ErrorResponse.error(415, nil, encodingError))) } } @@ -132,14 +131,14 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> { case is String.Type: validatedRequest.responseString(queue: apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() - + switch stringResponse.result { case let .success(value): completion(.success(Response(response: stringResponse.response!, body: value as? T))) case let .failure(error): completion(.failure(ErrorResponse.error(stringResponse.response?.statusCode ?? 500, stringResponse.data, error))) } - + }) case is URL.Type: validatedRequest.responseData(queue: apiResponseQueue, completionHandler: { (dataResponse) in @@ -188,26 +187,26 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> { case is Void.Type: validatedRequest.responseData(queue: apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() - + switch voidResponse.result { case .success: completion(.success(Response(response: voidResponse.response!, body: nil))) case let .failure(error): completion(.failure(ErrorResponse.error(voidResponse.response?.statusCode ?? 500, voidResponse.data, error))) } - + }) default: validatedRequest.responseData(queue: apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() - + switch dataResponse.result { case .success: completion(.success(Response(response: dataResponse.response!, body: dataResponse.data as? T))) case let .failure(error): completion(.failure(ErrorResponse.error(dataResponse.response?.statusCode ?? 500, dataResponse.data, error))) } - + }) } } @@ -220,7 +219,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> { return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { guard let contentDisposition = contentDisposition else { return nil @@ -228,7 +227,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> { let items = contentDisposition.components(separatedBy: ";") - var filename : String? = nil + var filename: String? for contentItem in items { @@ -239,7 +238,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> { filename = contentItem return filename? - .replacingCharacters(in: range, with:"") + .replacingCharacters(in: range, with: "") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } @@ -248,7 +247,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getPath(from url : URL) throws -> String { + fileprivate func getPath(from url: URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath @@ -262,7 +261,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL @@ -273,7 +272,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> { } -open class AlamofireDecodableRequestBuilder<T:Decodable>: AlamofireRequestBuilder<T> { +open class AlamofireDecodableRequestBuilder<T: Decodable>: AlamofireRequestBuilder<T> { override fileprivate func processRequest(request: DataRequest, _ managerId: String, _ apiResponseQueue: DispatchQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let credential = self.credential { @@ -290,7 +289,7 @@ open class AlamofireDecodableRequestBuilder<T:Decodable>: AlamofireRequestBuilde case is String.Type: validatedRequest.responseString(queue: apiResponseQueue, completionHandler: { (stringResponse) in cleanupRequest() - + switch stringResponse.result { case let .success(value): completion(.success(Response(response: stringResponse.response!, body: value as? T))) @@ -302,7 +301,7 @@ open class AlamofireDecodableRequestBuilder<T:Decodable>: AlamofireRequestBuilde case is Void.Type: validatedRequest.responseData(queue: apiResponseQueue, completionHandler: { (voidResponse) in cleanupRequest() - + switch voidResponse.result { case .success: completion(.success(Response(response: voidResponse.response!, body: nil))) @@ -314,7 +313,7 @@ open class AlamofireDecodableRequestBuilder<T:Decodable>: AlamofireRequestBuilde case is Data.Type: validatedRequest.responseData(queue: apiResponseQueue, completionHandler: { (dataResponse) in cleanupRequest() - + switch dataResponse.result { case .success: completion(.success(Response(response: dataResponse.response!, body: dataResponse.data as? T))) @@ -343,14 +342,14 @@ open class AlamofireDecodableRequestBuilder<T:Decodable>: AlamofireRequestBuilde } let decodeResult = CodableHelper.decode(T.self, from: data) - + switch decodeResult { case let .success(decodableObj): completion(.success(Response(response: httpResponse, body: decodableObj))) case let .failure(error): completion(.failure(ErrorResponse.error(httpResponse.statusCode, data, error))) } - + }) } } @@ -358,9 +357,9 @@ open class AlamofireDecodableRequestBuilder<T:Decodable>: AlamofireRequestBuilde } extension JSONDataEncoding: ParameterEncoding { - + // MARK: Encoding - + /// Creates a URL request by encoding parameters and applying them onto an existing request. /// /// - parameter urlRequest: The request to have parameters applied. @@ -372,7 +371,7 @@ extension JSONDataEncoding: ParameterEncoding { /// - returns: The encoded request. public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest { let urlRequest = try urlRequest.asURLRequest() - + return self.encode(urlRequest, with: parameters) } } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 01b28a4bd42d21245b26f53ba2766a44c3ff0d38..ef971ebadc60ae1d358d9d87e8727aa13ec7437b 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -45,4 +45,4 @@ open class CodableHelper { open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { return Swift.Result { try self.jsonEncoder.encode(value) } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift index f171525e43944f9cedf0e5146a39752fc2e848dc..627d9adb757ef30f3bf44723748aee6b5f1913d9 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,10 +7,10 @@ import Foundation open class Configuration { - + // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} \ No newline at end of file + +} 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 6e279679c67a1e7e3f302fc0fcbfd5b58a6dd12f..93ed6b90b376a7b84e9eabb1705f3dcb8bd98a14 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -108,24 +108,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { if let values = values { try encodeArray(values, forKey: key) } } - public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable { + public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable { + public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { - var tmpArray: [T]? = nil + public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? if contains(key) { tmpArray = try decodeArray(T.self, forKey: key) @@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable { - var map: [Self.Key : T] = [:] + public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -177,5 +177,3 @@ extension HTTPURLResponse { return Array(200 ..< 300).contains(statusCode) } } - - diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift index 08f1ef334dff10656c28e298c6b9b6d754159d73..b79e9f5e64d518e51552c62467884931ee1eaf3c 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -41,7 +41,7 @@ public struct JSONDataEncoding { } public static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? = nil + var returnedParams: [String: Any]? if let jsonData = jsonData, !jsonData.isEmpty { var params: [String: Any] = [:] params[jsonDataKey] = jsonData diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 314f1eff1f9b07d17db1930bfbe566baedbbc5cc..02f78ffb47056ddebac110679c4b545ed2861125 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -9,8 +9,8 @@ import Foundation open class JSONEncodingHelper { - open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? = nil + open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? // Encode the Encodable object if let encodableObj = encodableObj { @@ -27,7 +27,7 @@ open class JSONEncodingHelper { } open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? = nil + var params: [String: Any]? if let encodableObj = encodableObj { do { @@ -41,5 +41,5 @@ open class JSONEncodingHelper { return params } - + } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift index 11e81ffcc472bbe9ca94aecdf5b731470979d0de..c0542c14c0812d73834b48ba2123704b096bd61c 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,11 +10,11 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse : Error { +public enum ErrorResponse: Error { case error(Int, Data?, Error) } -public enum DownloadException : Error { +public enum DownloadException: Error { case responseDataMissing case responseFailed case requestMissing @@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error { case generalError(Error) } - open class Response<T> { public let statusCode: Int public let header: [String: String] @@ -44,7 +43,7 @@ open class Response<T> { public convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String:String]() + var header = [String: String]() for (key, value) in rawHeader { if let key = key.base as? String, let value = value as? String { header[key] = value diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 28ca8377b889b8436d0d11797c89daaa27864e9f..1af0315359678116da5f18a94457d0d2a1178e51 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,19 +7,17 @@ import Foundation +public struct AdditionalPropertiesClass: Codable { -public struct AdditionalPropertiesClass: Codable { + public var mapString: [String: String]? + public var mapMapString: [String: [String: String]]? - - public var mapString: [String:String]? - public var mapMapString: [String:[String:String]]? - - public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { + public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { self.mapString = mapString self.mapMapString = mapMapString } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapString = "map_string" case mapMapString = "map_map_string" } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index 1050d79dbe9df42e68f40f036c83f858d3cfd441..5ed9f31e2a364d0bf7a25bdf70cecb48af6ab5c4 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Animal: Codable { - +public struct Animal: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift index e7bea63f8ed28132865ea4d3c23eab55666cf4f6..e09b0e9efdc8ca7798114f24aff21f57e8f9fabd 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -7,5 +7,4 @@ import Foundation - public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index 4d0393b9ba45fb26499017214280bf04637ebe09..ec270da8907438877ee5cc303b093ceba3993297 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ApiResponse: Codable { - +public struct ApiResponse: Codable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 1363c96394baf0514e28045c00399b49591a962d..6c252ed475b2ed17ed9cd5a9eee4db0348886338 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfArrayOfNumberOnly: Codable { - +public struct ArrayOfArrayOfNumberOnly: Codable { public var arrayArrayNumber: [[Double]]? @@ -17,7 +15,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable { self.arrayArrayNumber = arrayArrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayArrayNumber = "ArrayArrayNumber" } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index 6b8873730c43cabe3911148ca8edc15b468d0a17..e84eb5d650258b37fdd423fadcfe1c7fc63962df 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfNumberOnly: Codable { - +public struct ArrayOfNumberOnly: Codable { public var arrayNumber: [Double]? @@ -17,7 +15,7 @@ public struct ArrayOfNumberOnly: Codable { self.arrayNumber = arrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayNumber = "ArrayNumber" } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index 64f7c6d9db99f4927f985c425f33a0d435c7d701..d2140933d1817725be708b41da4e996a549f3896 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayTest: Codable { - +public struct ArrayTest: Codable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? @@ -21,7 +19,7 @@ public struct ArrayTest: Codable { self.arrayArrayOfModel = arrayArrayOfModel } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayOfString = "array_of_string" case arrayArrayOfInteger = "array_array_of_integer" case arrayArrayOfModel = "array_array_of_model" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index ddb669a590459e81909408e9d2d9bc40dadfd38e..d1b3b27616edc9a2da27adb54c6b95ce056f8e91 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Capitalization: Codable { - +public struct Capitalization: Codable { public var smallCamel: String? public var capitalCamel: String? @@ -28,7 +26,7 @@ public struct Capitalization: Codable { self.ATT_NAME = ATT_NAME } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case smallCamel case capitalCamel = "CapitalCamel" case smallSnake = "small_Snake" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index c4f6e0d488caad736393f8a8936e5db63fec5378..7ab887f3113f1dd39f42b1019d8f58d45325f288 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Cat: Codable { - +public struct Cat: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift index 7b1d7e32be80ed62c3c1dda290093a4ea02a6c7b..a51ad0dffab1ba129591056cd816575af0e1ea09 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct CatAllOf: Codable { - +public struct CatAllOf: Codable { public var declawed: Bool? diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 3ec00f5ab10d19c5cd961c6316c9ec7960a85c57..eb8f7e5e1974989058473e4492c25c0004f1078c 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Category: Codable { - +public struct Category: Codable { public var id: Int64? public var name: String = "default-name" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index af030c3dd6269b59f42af7280976d3fa9dee9425..e2a7d4427a061dd104df50c1922ab1446e549106 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Codable { - +public struct ClassModel: Codable { public var _class: String? diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index 0aae748c76b4398015bcac633f082d0fbd84531a..00245ca37280eea9c87184eb0f40fb8bf03b81f2 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Client: Codable { - +public struct Client: Codable { public var client: String? diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 198e28b94dd6615a5da1b5c9efd0e13c3150de4a..492c1228008eb782ea0f927f65259ce2c7999d24 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Dog: Codable { - +public struct Dog: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift index 8ff49b2af23fc129b73f3bfc3e4c8a6d95b16ea5..7786f8acc5ae7d0de7de7248ef5a94d4d16f0a17 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct DogAllOf: Codable { - +public struct DogAllOf: Codable { public var breed: String? diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index e2d3fa04f94b92473f218965cf21bb8eb8e82ee2..9844e7c40e35868546bb256fd806eb8b30b135f2 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumArrays: Codable { - +public struct EnumArrays: Codable { public enum JustSymbol: String, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -27,7 +25,7 @@ public struct EnumArrays: Codable { self.arrayEnum = arrayEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justSymbol = "just_symbol" case arrayEnum = "array_enum" } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift index c2c639ba3246c2c7d30830770fc80529114eca31..d4029d73f8aff2b20baf7856bb6517a1407731b5 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -7,7 +7,6 @@ import Foundation - public enum EnumClass: String, Codable, CaseIterable { case abc = "_abc" case efg = "-efg" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index a56e1f36389b91b5bf92522d6248b9fc69d3c386..789f583e1d778b6b26d6270fe386e3b88b406488 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumTest: Codable { - +public struct EnumTest: Codable { public enum EnumString: String, Codable, CaseIterable { case upper = "UPPER" @@ -43,7 +41,7 @@ public struct EnumTest: Codable { self.outerEnum = outerEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case enumString = "enum_string" case enumStringRequired = "enum_string_required" case enumInteger = "enum_integer" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift index 773b53b2cb765586e3a14e4034a7c8da7a177363..abf3ccffc48588b98475607b17878c7d03320f48 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,8 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Codable { - +public struct File: Codable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 83dc1148cfa3d6e9bbcb2d78f2d62b38045668b6..532f1457939af300b65f89821673cf1951ec2f0b 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FileSchemaTestClass: Codable { - +public struct FileSchemaTestClass: Codable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index bccd3f9fb1786b11e4d4dc8e97ca6bd3e73f4cab..20bd6d103b3dc87ffa6d7f38b21d957318628930 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FormatTest: Codable { - +public struct FormatTest: Codable { public var integer: Int? public var int32: Int? diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index 566d71a35ef0193c3e0ca140a6adabfcdc84588f..906ddb06fb170e5de30f07754fce3efc4f512ee1 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct HasOnlyReadOnly: Codable { - +public struct HasOnlyReadOnly: Codable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 80cecab242f25976c3ac5b7538ca07f7d1a1e1b8..fe13d302ccbfde321339be7d09f6932248c2570e 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,9 +7,7 @@ import Foundation - -public struct List: Codable { - +public struct List: Codable { public var _123list: String? @@ -17,7 +15,7 @@ public struct List: Codable { self._123list = _123list } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _123list = "123-list" } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index f0c02de95f7abe0f4bd7fac695d9c590120d8504..4b6037f378ee6b0152805f8b11d374a16373e222 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,27 +7,25 @@ import Foundation - -public struct MapTest: Codable { - +public struct MapTest: Codable { public enum MapOfEnumString: String, Codable, CaseIterable { case upper = "UPPER" case lower = "lower" } - public var mapMapOfString: [String:[String:String]]? - public var mapOfEnumString: [String:String]? - public var directMap: [String:Bool]? + public var mapMapOfString: [String: [String: String]]? + public var mapOfEnumString: [String: String]? + public var directMap: [String: Bool]? public var indirectMap: StringBooleanMap? - public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) { + public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { self.mapMapOfString = mapMapOfString self.mapOfEnumString = mapOfEnumString self.directMap = directMap self.indirectMap = indirectMap } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapMapOfString = "map_map_of_string" case mapOfEnumString = "map_of_enum_string" case directMap = "direct_map" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 710e62a9b5875c830a4885dac70b0bedb56d32b2..c3deb2f28932f5d0ab338f3da2ac398de24a8822 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,15 +7,13 @@ import Foundation - -public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { - +public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { public var uuid: UUID? public var dateTime: Date? - public var map: [String:Animal]? + public var map: [String: Animal]? - public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) { + public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { self.uuid = uuid self.dateTime = dateTime self.map = map diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index 450a53b918ca0d82e9697268575f6315bd76e1c7..b61db7d6e716185b1b6f21ac2c536f3d5e408809 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Codable { - +public struct Model200Response: Codable { public var name: Int? public var _class: String? @@ -19,7 +18,7 @@ public struct Model200Response: Codable { self._class = _class } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case _class = "class" } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index 6deb69fcd7313698cb05f790654c47f98a303665..8ab4db44b73a3726cc854651fef382bd9fcf69b6 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Codable { - +public struct Name: Codable { public var name: Int public var snakeCase: Int? @@ -23,7 +22,7 @@ public struct Name: Codable { self._123number = _123number } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case snakeCase = "snake_case" case property diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 0c9ee2b7b9f4a7fcd3a7c1ed1e142e8fcce4cf84..4d1dafcc2c1f56bf9c7e317734efc71ee9fbd09a 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct NumberOnly: Codable { - +public struct NumberOnly: Codable { public var justNumber: Double? @@ -17,7 +15,7 @@ public struct NumberOnly: Codable { self.justNumber = justNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justNumber = "JustNumber" } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index ab0eac0b304e4a248aa897d86579bde395947b77..40c30cc8609c33fd59240aae30ba7d942e4d3659 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Order: Codable { - +public struct Order: Codable { public enum Status: String, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 4a7d227104413d7065789fa87b4c2f41078130a0..18c3a024f1227af549fb1b13b1838f1e81a837b1 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,9 +7,7 @@ import Foundation - -public struct OuterComposite: Codable { - +public struct OuterComposite: Codable { public var myNumber: Double? public var myString: String? @@ -21,7 +19,7 @@ public struct OuterComposite: Codable { self.myBoolean = myBoolean } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case myNumber = "my_number" case myString = "my_string" case myBoolean = "my_boolean" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift index 9e6b8d74e874c1d75bf8afbb92296996e39cf366..c3b778cbbed444c54045dedb48213ce3bb532dbf 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -7,7 +7,6 @@ import Foundation - public enum OuterEnum: String, Codable, CaseIterable { case placed = "placed" case approved = "approved" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index a973071d6c9615c7e082183ec555eb794bb11b3b..b9ce0e933256c401ced1143aaa31936cf60bdb63 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Pet: Codable { - +public struct Pet: Codable { public enum Status: String, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index b2a6b7e2b8a61e14c75f22de2da766e96afc1fca..0acd21fd10000317ffc9f96840a49b3dd538d0c7 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ReadOnlyFirst: Codable { - +public struct ReadOnlyFirst: Codable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index 7e089dcee2b4a366353619ee201eb067bb63ed71..c223f993a69ece3abf5451c68d01eb666dad5b19 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Codable { - +public struct Return: Codable { public var _return: Int? @@ -17,7 +16,7 @@ public struct Return: Codable { self._return = _return } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _return = "return" } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index e890ef952520010cb37b71b4f4c06215b4f7c88c..6e8650f76d8ece4a8511cf0afacf62816e852598 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,9 +7,7 @@ import Foundation - -public struct SpecialModelName: Codable { - +public struct SpecialModelName: Codable { public var specialPropertyName: Int64? @@ -17,7 +15,7 @@ public struct SpecialModelName: Codable { self.specialPropertyName = specialPropertyName } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case specialPropertyName = "$special[property.name]" } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index f65ae0623d6e8567ed17f651d3c0ff056fefb1ba..3f1237fee477a298b1d99cef8062371e2f101f59 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,12 +7,9 @@ import Foundation +public struct StringBooleanMap: Codable { -public struct StringBooleanMap: Codable { - - - - public var additionalProperties: [String:Bool] = [:] + public var additionalProperties: [String: Bool] = [:] public subscript(key: String) -> Bool? { get { @@ -45,5 +42,4 @@ public struct StringBooleanMap: Codable { additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index a91b6061bcf78c8ad31d4ae87401afa4ac72330b..4dd8a9a9f5a0fc547c88401b39caf0f00cddd61d 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Tag: Codable { - +public struct Tag: Codable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index 2d377c3edb02c59cbf82ae4bc9534eba7c3f3e2b..a9e088808ed378dfa9690f8dfa1fc687294bd3bd 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderDefault: Codable { - +public struct TypeHolderDefault: Codable { public var stringItem: String = "what" public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderDefault: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index e5eb92da696e19c998edd122f874f9f7fa776148..dff4083ae43260c42e61413843b52749b26b6769 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderExample: Codable { - +public struct TypeHolderExample: Codable { public var stringItem: String public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderExample: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift index f70328ca9e597ffca3abc70b5340fda99848a4d1..79f271ed73564b8af07f2698e649f38062255ce7 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,9 +7,7 @@ import Foundation - -public struct User: Codable { - +public struct User: Codable { public var id: Int64? public var username: String? diff --git a/samples/client/petstore/swift5/combineLibrary/Package.swift b/samples/client/petstore/swift5/combineLibrary/Package.swift index 79f6f81887383d4539292942c364aed2cfcfb5c6..96dfff54edf415c3c22de54b2758012c629b6f79 100644 --- a/samples/client/petstore/swift5/combineLibrary/Package.swift +++ b/samples/client/petstore/swift5/combineLibrary/Package.swift @@ -14,7 +14,7 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "PetstoreClient", - targets: ["PetstoreClient"]), + targets: ["PetstoreClient"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -26,6 +26,6 @@ let package = Package( name: "PetstoreClient", dependencies: [], path: "PetstoreClient/Classes" - ), + ) ] ) diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 2404bc8ffc6d6a190b82327193d4b5b2325dd515..5b09f9557113d4bc4d0ca8b0b05b4f408008c2ff 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,7 +7,7 @@ import Foundation public struct APIHelper { - public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,17 +20,17 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? Array<Any?> { - result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" } } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { guard let source = source else { return nil } @@ -46,15 +46,15 @@ public struct APIHelper { } public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? Array<Any?> { + if let collection = source as? [Any?] { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? Array<Any?> { + if let collection = item.value as? [Any?] { collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in result.append(URLQueryItem(name: item.key, value: value)) } @@ -69,4 +69,3 @@ public struct APIHelper { return destination } } - diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index c5d1b9b42df33641cc1c81227a5027da0da95336..a5c2d605dff6f91df4130c2ff02d09919bae6974 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,15 +9,15 @@ import Foundation open class PetstoreClientAPI { public static var basePath = "http://petstore.swagger.io:80/v2" public static var credential: URLCredential? - public static var customHeaders: [String:String] = [:] + public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder<T> { var credential: URLCredential? - var headers: [String:String] - public let parameters: [String:Any]? + var headers: [String: String] + public let parameters: [String: Any]? public let isBody: Bool public let method: String public let URLString: String @@ -25,9 +25,9 @@ open class RequestBuilder<T> { /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. /// If you need to get the request's progress in older OS versions, please use Alamofire http client. - public var onProgressReady: ((Progress) -> ())? + public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -37,7 +37,7 @@ open class RequestBuilder<T> { addHeaders(PetstoreClientAPI.customHeaders) } - open func addHeaders(_ aHeaders:[String:String]) { + open func addHeaders(_ aHeaders: [String: String]) { for (header, value) in aHeaders { headers[header] = value } @@ -60,5 +60,5 @@ open class RequestBuilder<T> { public protocol RequestBuilderFactory { func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type } 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 cf5a4a61c29156aec63aa0eab186f8d4ecec4dbb..2df909dec9ad3ebfcfe00c03a3e6260f46e79a05 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 @@ -8,8 +8,6 @@ import Foundation import Combine - - open class AnotherFakeAPI { /** 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 ccfdc072331fa9740bcfdff8392331dc4de64a30..47510b7781a5e27873bae07dd3b77f0930442b31 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 @@ -8,8 +8,6 @@ import Foundation import Combine - - open class FakeAPI { /** @@ -343,7 +341,7 @@ open class FakeAPI { open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), @@ -362,7 +360,7 @@ open class FakeAPI { let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -482,19 +480,19 @@ open class FakeAPI { open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "enum_form_string_array": enumFormStringArray?.encodeToJSON(), "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), - "enum_query_string": enumQueryString?.encodeToJSON(), - "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -549,13 +547,13 @@ open class FakeAPI { open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": requiredStringGroup.encodeToJSON(), - "required_int64_group": requiredInt64Group.encodeToJSON(), - "string_group": stringGroup?.encodeToJSON(), + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -577,7 +575,7 @@ open class FakeAPI { - returns: AnyPublisher<Void, Error> */ @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<Void, Error> { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<Void, Error> { return Future<Void, Error>.init { promisse in testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in switch result { @@ -596,7 +594,7 @@ open class FakeAPI { - parameter param: (body) request body - returns: RequestBuilder<Void> */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> { let path = "/fake/inline-additionalProperties" let URLString = PetstoreClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) @@ -640,14 +638,14 @@ open class FakeAPI { open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "param": param.encodeToJSON(), "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() 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 7d04bd796bb76c8b4982695d3a7051f69bed303a..6f0401af8885e64a445af1cb23d7acda01633321 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 @@ -8,8 +8,6 @@ import Foundation import Combine - - open class FakeClassnameTags123API { /** 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 6c288c225c7aa41c8e4905f9f8e1f6d62c53845a..309ee4e9686e6d97af9ba68ca8c6837a914d89af 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 @@ -8,8 +8,6 @@ import Foundation import Combine - - open class PetAPI { /** Add a new pet to the store @@ -91,8 +89,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ "api_key": apiKey?.encodeToJSON() @@ -147,8 +145,8 @@ open class PetAPI { open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "status": status.encodeToJSON() @@ -195,8 +193,8 @@ open class PetAPI { open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "tags": tags.encodeToJSON() @@ -244,8 +242,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -335,14 +333,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "name": name?.encodeToJSON(), "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -390,14 +388,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -445,14 +443,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() 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 1a4392975b6b36d66fb05c0a16fdacc264dca2c3..b36a3a30c3a53ee69df9a226b2882582b454c845 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 @@ -8,8 +8,6 @@ import Foundation import Combine - - open class StoreAPI { /** Delete purchase order by ID @@ -45,8 +43,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -61,8 +59,8 @@ open class StoreAPI { - returns: AnyPublisher<[String:Int], Error> */ @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 { promisse in + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> AnyPublisher<[String: Int], Error> { + return Future<[String: Int], Error>.init { promisse in getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -83,14 +81,14 @@ open class StoreAPI { - name: api_key - returns: RequestBuilder<[String:Int]> */ - open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { let path = "/store/inventory" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } @@ -129,8 +127,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() 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 59fec6d34fe6eb1646accaa9e42b32d94eaf6914..3d5694cc935c995c0b0a663655d1685b2437e689 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 @@ -8,8 +8,6 @@ import Foundation import Combine - - open class UserAPI { /** Create user @@ -163,8 +161,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -205,8 +203,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -247,11 +245,11 @@ open class UserAPI { open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username.encodeToJSON(), + "username": username.encodeToJSON(), "password": password.encodeToJSON() ]) @@ -288,8 +286,8 @@ open class UserAPI { open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 01b28a4bd42d21245b26f53ba2766a44c3ff0d38..ef971ebadc60ae1d358d9d87e8727aa13ec7437b 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -45,4 +45,4 @@ open class CodableHelper { open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { return Swift.Result { try self.jsonEncoder.encode(value) } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift index f171525e43944f9cedf0e5146a39752fc2e848dc..627d9adb757ef30f3bf44723748aee6b5f1913d9 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,10 +7,10 @@ import Foundation open class Configuration { - + // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} \ No newline at end of file + +} 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 6e279679c67a1e7e3f302fc0fcbfd5b58a6dd12f..93ed6b90b376a7b84e9eabb1705f3dcb8bd98a14 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -108,24 +108,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { if let values = values { try encodeArray(values, forKey: key) } } - public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable { + public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable { + public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { - var tmpArray: [T]? = nil + public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? if contains(key) { tmpArray = try decodeArray(T.self, forKey: key) @@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable { - var map: [Self.Key : T] = [:] + public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -177,5 +177,3 @@ extension HTTPURLResponse { return Array(200 ..< 300).contains(statusCode) } } - - diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift index 08f1ef334dff10656c28e298c6b9b6d754159d73..b79e9f5e64d518e51552c62467884931ee1eaf3c 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -41,7 +41,7 @@ public struct JSONDataEncoding { } public static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? = nil + var returnedParams: [String: Any]? if let jsonData = jsonData, !jsonData.isEmpty { var params: [String: Any] = [:] params[jsonDataKey] = jsonData diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 314f1eff1f9b07d17db1930bfbe566baedbbc5cc..02f78ffb47056ddebac110679c4b545ed2861125 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -9,8 +9,8 @@ import Foundation open class JSONEncodingHelper { - open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? = nil + open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? // Encode the Encodable object if let encodableObj = encodableObj { @@ -27,7 +27,7 @@ open class JSONEncodingHelper { } open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? = nil + var params: [String: Any]? if let encodableObj = encodableObj { do { @@ -41,5 +41,5 @@ open class JSONEncodingHelper { return params } - + } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift index 11e81ffcc472bbe9ca94aecdf5b731470979d0de..c0542c14c0812d73834b48ba2123704b096bd61c 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,11 +10,11 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse : Error { +public enum ErrorResponse: Error { case error(Int, Data?, Error) } -public enum DownloadException : Error { +public enum DownloadException: Error { case responseDataMissing case responseFailed case requestMissing @@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error { case generalError(Error) } - open class Response<T> { public let statusCode: Int public let header: [String: String] @@ -44,7 +43,7 @@ open class Response<T> { public convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String:String]() + var header = [String: String]() for (key, value) in rawHeader { if let key = key.base as? String, let value = value as? String { header[key] = value diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 28ca8377b889b8436d0d11797c89daaa27864e9f..1af0315359678116da5f18a94457d0d2a1178e51 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,19 +7,17 @@ import Foundation +public struct AdditionalPropertiesClass: Codable { -public struct AdditionalPropertiesClass: Codable { + public var mapString: [String: String]? + public var mapMapString: [String: [String: String]]? - - public var mapString: [String:String]? - public var mapMapString: [String:[String:String]]? - - public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { + public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { self.mapString = mapString self.mapMapString = mapMapString } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapString = "map_string" case mapMapString = "map_map_string" } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index 1050d79dbe9df42e68f40f036c83f858d3cfd441..5ed9f31e2a364d0bf7a25bdf70cecb48af6ab5c4 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Animal: Codable { - +public struct Animal: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift index e7bea63f8ed28132865ea4d3c23eab55666cf4f6..e09b0e9efdc8ca7798114f24aff21f57e8f9fabd 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -7,5 +7,4 @@ import Foundation - public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index 4d0393b9ba45fb26499017214280bf04637ebe09..ec270da8907438877ee5cc303b093ceba3993297 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ApiResponse: Codable { - +public struct ApiResponse: Codable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 1363c96394baf0514e28045c00399b49591a962d..6c252ed475b2ed17ed9cd5a9eee4db0348886338 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfArrayOfNumberOnly: Codable { - +public struct ArrayOfArrayOfNumberOnly: Codable { public var arrayArrayNumber: [[Double]]? @@ -17,7 +15,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable { self.arrayArrayNumber = arrayArrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayArrayNumber = "ArrayArrayNumber" } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index 6b8873730c43cabe3911148ca8edc15b468d0a17..e84eb5d650258b37fdd423fadcfe1c7fc63962df 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfNumberOnly: Codable { - +public struct ArrayOfNumberOnly: Codable { public var arrayNumber: [Double]? @@ -17,7 +15,7 @@ public struct ArrayOfNumberOnly: Codable { self.arrayNumber = arrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayNumber = "ArrayNumber" } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index 64f7c6d9db99f4927f985c425f33a0d435c7d701..d2140933d1817725be708b41da4e996a549f3896 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayTest: Codable { - +public struct ArrayTest: Codable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? @@ -21,7 +19,7 @@ public struct ArrayTest: Codable { self.arrayArrayOfModel = arrayArrayOfModel } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayOfString = "array_of_string" case arrayArrayOfInteger = "array_array_of_integer" case arrayArrayOfModel = "array_array_of_model" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index ddb669a590459e81909408e9d2d9bc40dadfd38e..d1b3b27616edc9a2da27adb54c6b95ce056f8e91 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Capitalization: Codable { - +public struct Capitalization: Codable { public var smallCamel: String? public var capitalCamel: String? @@ -28,7 +26,7 @@ public struct Capitalization: Codable { self.ATT_NAME = ATT_NAME } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case smallCamel case capitalCamel = "CapitalCamel" case smallSnake = "small_Snake" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index c4f6e0d488caad736393f8a8936e5db63fec5378..7ab887f3113f1dd39f42b1019d8f58d45325f288 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Cat: Codable { - +public struct Cat: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift index 7b1d7e32be80ed62c3c1dda290093a4ea02a6c7b..a51ad0dffab1ba129591056cd816575af0e1ea09 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct CatAllOf: Codable { - +public struct CatAllOf: Codable { public var declawed: Bool? diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 3ec00f5ab10d19c5cd961c6316c9ec7960a85c57..eb8f7e5e1974989058473e4492c25c0004f1078c 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Category: Codable { - +public struct Category: Codable { public var id: Int64? public var name: String = "default-name" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index af030c3dd6269b59f42af7280976d3fa9dee9425..e2a7d4427a061dd104df50c1922ab1446e549106 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Codable { - +public struct ClassModel: Codable { public var _class: String? diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index 0aae748c76b4398015bcac633f082d0fbd84531a..00245ca37280eea9c87184eb0f40fb8bf03b81f2 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Client: Codable { - +public struct Client: Codable { public var client: String? diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 198e28b94dd6615a5da1b5c9efd0e13c3150de4a..492c1228008eb782ea0f927f65259ce2c7999d24 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Dog: Codable { - +public struct Dog: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift index 8ff49b2af23fc129b73f3bfc3e4c8a6d95b16ea5..7786f8acc5ae7d0de7de7248ef5a94d4d16f0a17 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct DogAllOf: Codable { - +public struct DogAllOf: Codable { public var breed: String? diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index e2d3fa04f94b92473f218965cf21bb8eb8e82ee2..9844e7c40e35868546bb256fd806eb8b30b135f2 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumArrays: Codable { - +public struct EnumArrays: Codable { public enum JustSymbol: String, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -27,7 +25,7 @@ public struct EnumArrays: Codable { self.arrayEnum = arrayEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justSymbol = "just_symbol" case arrayEnum = "array_enum" } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift index c2c639ba3246c2c7d30830770fc80529114eca31..d4029d73f8aff2b20baf7856bb6517a1407731b5 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -7,7 +7,6 @@ import Foundation - public enum EnumClass: String, Codable, CaseIterable { case abc = "_abc" case efg = "-efg" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index a56e1f36389b91b5bf92522d6248b9fc69d3c386..789f583e1d778b6b26d6270fe386e3b88b406488 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumTest: Codable { - +public struct EnumTest: Codable { public enum EnumString: String, Codable, CaseIterable { case upper = "UPPER" @@ -43,7 +41,7 @@ public struct EnumTest: Codable { self.outerEnum = outerEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case enumString = "enum_string" case enumStringRequired = "enum_string_required" case enumInteger = "enum_integer" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift index 773b53b2cb765586e3a14e4034a7c8da7a177363..abf3ccffc48588b98475607b17878c7d03320f48 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,8 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Codable { - +public struct File: Codable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 83dc1148cfa3d6e9bbcb2d78f2d62b38045668b6..532f1457939af300b65f89821673cf1951ec2f0b 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FileSchemaTestClass: Codable { - +public struct FileSchemaTestClass: Codable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index bccd3f9fb1786b11e4d4dc8e97ca6bd3e73f4cab..20bd6d103b3dc87ffa6d7f38b21d957318628930 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FormatTest: Codable { - +public struct FormatTest: Codable { public var integer: Int? public var int32: Int? diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index 566d71a35ef0193c3e0ca140a6adabfcdc84588f..906ddb06fb170e5de30f07754fce3efc4f512ee1 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct HasOnlyReadOnly: Codable { - +public struct HasOnlyReadOnly: Codable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 80cecab242f25976c3ac5b7538ca07f7d1a1e1b8..fe13d302ccbfde321339be7d09f6932248c2570e 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,9 +7,7 @@ import Foundation - -public struct List: Codable { - +public struct List: Codable { public var _123list: String? @@ -17,7 +15,7 @@ public struct List: Codable { self._123list = _123list } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _123list = "123-list" } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index f0c02de95f7abe0f4bd7fac695d9c590120d8504..4b6037f378ee6b0152805f8b11d374a16373e222 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,27 +7,25 @@ import Foundation - -public struct MapTest: Codable { - +public struct MapTest: Codable { public enum MapOfEnumString: String, Codable, CaseIterable { case upper = "UPPER" case lower = "lower" } - public var mapMapOfString: [String:[String:String]]? - public var mapOfEnumString: [String:String]? - public var directMap: [String:Bool]? + public var mapMapOfString: [String: [String: String]]? + public var mapOfEnumString: [String: String]? + public var directMap: [String: Bool]? public var indirectMap: StringBooleanMap? - public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) { + public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { self.mapMapOfString = mapMapOfString self.mapOfEnumString = mapOfEnumString self.directMap = directMap self.indirectMap = indirectMap } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapMapOfString = "map_map_of_string" case mapOfEnumString = "map_of_enum_string" case directMap = "direct_map" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 710e62a9b5875c830a4885dac70b0bedb56d32b2..c3deb2f28932f5d0ab338f3da2ac398de24a8822 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,15 +7,13 @@ import Foundation - -public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { - +public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { public var uuid: UUID? public var dateTime: Date? - public var map: [String:Animal]? + public var map: [String: Animal]? - public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) { + public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { self.uuid = uuid self.dateTime = dateTime self.map = map diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index 450a53b918ca0d82e9697268575f6315bd76e1c7..b61db7d6e716185b1b6f21ac2c536f3d5e408809 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Codable { - +public struct Model200Response: Codable { public var name: Int? public var _class: String? @@ -19,7 +18,7 @@ public struct Model200Response: Codable { self._class = _class } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case _class = "class" } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index 6deb69fcd7313698cb05f790654c47f98a303665..8ab4db44b73a3726cc854651fef382bd9fcf69b6 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Codable { - +public struct Name: Codable { public var name: Int public var snakeCase: Int? @@ -23,7 +22,7 @@ public struct Name: Codable { self._123number = _123number } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case snakeCase = "snake_case" case property diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 0c9ee2b7b9f4a7fcd3a7c1ed1e142e8fcce4cf84..4d1dafcc2c1f56bf9c7e317734efc71ee9fbd09a 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct NumberOnly: Codable { - +public struct NumberOnly: Codable { public var justNumber: Double? @@ -17,7 +15,7 @@ public struct NumberOnly: Codable { self.justNumber = justNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justNumber = "JustNumber" } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index ab0eac0b304e4a248aa897d86579bde395947b77..40c30cc8609c33fd59240aae30ba7d942e4d3659 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Order: Codable { - +public struct Order: Codable { public enum Status: String, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 4a7d227104413d7065789fa87b4c2f41078130a0..18c3a024f1227af549fb1b13b1838f1e81a837b1 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,9 +7,7 @@ import Foundation - -public struct OuterComposite: Codable { - +public struct OuterComposite: Codable { public var myNumber: Double? public var myString: String? @@ -21,7 +19,7 @@ public struct OuterComposite: Codable { self.myBoolean = myBoolean } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case myNumber = "my_number" case myString = "my_string" case myBoolean = "my_boolean" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift index 9e6b8d74e874c1d75bf8afbb92296996e39cf366..c3b778cbbed444c54045dedb48213ce3bb532dbf 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -7,7 +7,6 @@ import Foundation - public enum OuterEnum: String, Codable, CaseIterable { case placed = "placed" case approved = "approved" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index a973071d6c9615c7e082183ec555eb794bb11b3b..b9ce0e933256c401ced1143aaa31936cf60bdb63 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Pet: Codable { - +public struct Pet: Codable { public enum Status: String, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index b2a6b7e2b8a61e14c75f22de2da766e96afc1fca..0acd21fd10000317ffc9f96840a49b3dd538d0c7 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ReadOnlyFirst: Codable { - +public struct ReadOnlyFirst: Codable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index 7e089dcee2b4a366353619ee201eb067bb63ed71..c223f993a69ece3abf5451c68d01eb666dad5b19 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Codable { - +public struct Return: Codable { public var _return: Int? @@ -17,7 +16,7 @@ public struct Return: Codable { self._return = _return } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _return = "return" } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index e890ef952520010cb37b71b4f4c06215b4f7c88c..6e8650f76d8ece4a8511cf0afacf62816e852598 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,9 +7,7 @@ import Foundation - -public struct SpecialModelName: Codable { - +public struct SpecialModelName: Codable { public var specialPropertyName: Int64? @@ -17,7 +15,7 @@ public struct SpecialModelName: Codable { self.specialPropertyName = specialPropertyName } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case specialPropertyName = "$special[property.name]" } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index f65ae0623d6e8567ed17f651d3c0ff056fefb1ba..3f1237fee477a298b1d99cef8062371e2f101f59 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,12 +7,9 @@ import Foundation +public struct StringBooleanMap: Codable { -public struct StringBooleanMap: Codable { - - - - public var additionalProperties: [String:Bool] = [:] + public var additionalProperties: [String: Bool] = [:] public subscript(key: String) -> Bool? { get { @@ -45,5 +42,4 @@ public struct StringBooleanMap: Codable { additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index a91b6061bcf78c8ad31d4ae87401afa4ac72330b..4dd8a9a9f5a0fc547c88401b39caf0f00cddd61d 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Tag: Codable { - +public struct Tag: Codable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index 2d377c3edb02c59cbf82ae4bc9534eba7c3f3e2b..a9e088808ed378dfa9690f8dfa1fc687294bd3bd 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderDefault: Codable { - +public struct TypeHolderDefault: Codable { public var stringItem: String = "what" public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderDefault: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index e5eb92da696e19c998edd122f874f9f7fa776148..dff4083ae43260c42e61413843b52749b26b6769 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderExample: Codable { - +public struct TypeHolderExample: Codable { public var stringItem: String public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderExample: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift index f70328ca9e597ffca3abc70b5340fda99848a4d1..79f271ed73564b8af07f2698e649f38062255ce7 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,9 +7,7 @@ import Foundation - -public struct User: Codable { - +public struct User: Codable { public var id: Int64? public var username: String? 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 22261e2ce9483f4ac59c12ff516a53863a606132..55d0eb42191942998769644daea74ffeb51cbcd7 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -14,7 +14,7 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { return URLSessionRequestBuilder<T>.self } - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type { + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { return URLSessionDecodableRequestBuilder<T>.self } } @@ -23,16 +23,16 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { private var urlSessionStore = SynchronizedDictionary<String, URLSession>() open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - + private var observation: NSKeyValueObservation? - + deinit { observation?.invalidate() } - + // swiftlint:disable:next weak_delegate fileprivate let sessionDelegate = SessionDelegate() - + /** May be assigned if you want to control the authentication challenges. */ @@ -45,11 +45,11 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - retry the request. */ public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? - - required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { + + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } - + /** May be overridden by a subclass if you want to control the URLSession configuration. @@ -77,40 +77,40 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { May be overridden by a subclass if you want to control the URLRequest configuration (e.g. to override the cache policy). */ - open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) throws -> URLRequest { - + open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { + guard let url = URL(string: URLString) else { throw DownloadException.requestMissingURL } - + var originalRequest = URLRequest(url: url) - + originalRequest.httpMethod = method.rawValue - + buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + headers.forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) - + return modifiedRequest } override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { - let urlSessionId:String = UUID().uuidString + let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() urlSessionStore[urlSessionId] = urlSession - + let parameters: [String: Any] = self.parameters ?? [:] - + let fileKeys = parameters.filter { $1 is URL } .map { $0.0 } - + let encoding: ParameterEncoding if fileKeys.count > 0 { encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) @@ -119,29 +119,29 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } else { encoding = URLEncoding() } - + guard let xMethod = HTTPMethod(rawValue: method) else { fatalError("Unsuported Http method - \(method)") } - + let cleanupRequest = { urlSessionStore[urlSessionId] = nil self.observation?.invalidate() } - + do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - + let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - + guard let self = self else { return } - + if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - + taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - + guard let self = self else { return } - + if shouldRetry { cleanupRequest() self.execute(apiResponseQueue, completion) @@ -157,13 +157,13 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } } - + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { onProgressReady?(dataTask.progress) } - + dataTask.resume() - + } catch { apiResponseQueue.async { cleanupRequest() @@ -172,7 +172,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } - + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -192,52 +192,52 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is URL.Type: do { - + guard error == nil else { throw DownloadException.responseFailed } - + guard let data = data else { throw DownloadException.responseDataMissing } - + let fileManager = FileManager.default let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] let requestURL = try self.getURL(from: urlRequest) - + var requestPath = try self.getPath(from: requestURL) - + if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { requestPath = requestPath.appending("/\(headerFileName)") } - + let filePath = documentsDirectory.appendingPathComponent(requestPath) let directoryPath = filePath.deletingLastPathComponent().path - + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) - + completion(.success(Response(response: httpResponse, body: filePath as? T))) - + } catch let requestParserError as DownloadException { completion(.failure(ErrorResponse.error(400, data, requestParserError))) } catch let error { completion(.failure(ErrorResponse.error(400, data, error))) } - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + default: - + completion(.success(Response(response: httpResponse, body: data as? T))) } @@ -251,7 +251,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { guard let contentDisposition = contentDisposition else { return nil @@ -270,7 +270,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { filename = contentItem return filename? - .replacingCharacters(in: range, with:"") + .replacingCharacters(in: range, with: "") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } @@ -279,7 +279,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getPath(from url : URL) throws -> String { + fileprivate func getPath(from url: URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath @@ -293,7 +293,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL @@ -304,7 +304,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } -open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuilder<T> { +open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -324,28 +324,28 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + case is Data.Type: - + completion(.success(Response(response: httpResponse, body: data as? T))) - + default: - + guard let data = data, !data.isEmpty else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse))) return } - + let decodeResult = CodableHelper.decode(T.self, from: data) - + switch decodeResult { case let .success(decodableObj): completion(.success(Response(response: httpResponse, body: decodableObj))) @@ -356,10 +356,10 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil } } -fileprivate class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { - +private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { + var credential: URLCredential? - + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { @@ -402,13 +402,13 @@ public protocol ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest } -fileprivate class URLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) throws -> URLRequest { - +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - + guard let parameters = parameters else { return urlRequest } - + guard let url = urlRequest.url else { throw DownloadException.requestMissingURL } @@ -417,12 +417,12 @@ fileprivate class URLEncoding: ParameterEncoding { urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) urlRequest.url = urlComponents.url } - + return urlRequest } } -fileprivate class FileUploadEncoding: ParameterEncoding { +private class FileUploadEncoding: ParameterEncoding { let contentTypeForFormPart: (_ fileURL: URL) -> String? @@ -433,13 +433,13 @@ fileprivate class FileUploadEncoding: ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { var urlRequest = urlRequest - + guard let parameters = parameters, !parameters.isEmpty else { return urlRequest } - + let boundary = "Boundary-\(UUID().uuidString)" - + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") for (key, value) in parameters { @@ -479,7 +479,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { fatalError("Unprocessable value \(value) with key \(key)") } } - + var body = urlRequest.httpBody.orEmpty body.append("\r\n--\(boundary)--\r\n") @@ -494,7 +494,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { var urlRequest = urlRequest var body = urlRequest.httpBody.orEmpty - + let fileData = try Data(contentsOf: fileURL) let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) @@ -502,7 +502,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } @@ -518,20 +518,20 @@ fileprivate class FileUploadEncoding: ParameterEncoding { // The value data. body.append(fileData) - + urlRequest.httpBody = body return urlRequest } - + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { var urlRequest = urlRequest - + var body = urlRequest.httpBody.orEmpty // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } diff --git a/samples/client/petstore/swift5/default/Package.swift b/samples/client/petstore/swift5/default/Package.swift index 79f6f81887383d4539292942c364aed2cfcfb5c6..96dfff54edf415c3c22de54b2758012c629b6f79 100644 --- a/samples/client/petstore/swift5/default/Package.swift +++ b/samples/client/petstore/swift5/default/Package.swift @@ -14,7 +14,7 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "PetstoreClient", - targets: ["PetstoreClient"]), + targets: ["PetstoreClient"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -26,6 +26,6 @@ let package = Package( name: "PetstoreClient", dependencies: [], path: "PetstoreClient/Classes" - ), + ) ] ) diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 2404bc8ffc6d6a190b82327193d4b5b2325dd515..5b09f9557113d4bc4d0ca8b0b05b4f408008c2ff 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,7 +7,7 @@ import Foundation public struct APIHelper { - public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,17 +20,17 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? Array<Any?> { - result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" } } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { guard let source = source else { return nil } @@ -46,15 +46,15 @@ public struct APIHelper { } public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? Array<Any?> { + if let collection = source as? [Any?] { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? Array<Any?> { + if let collection = item.value as? [Any?] { collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in result.append(URLQueryItem(name: item.key, value: value)) } @@ -69,4 +69,3 @@ public struct APIHelper { return destination } } - diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift index c5d1b9b42df33641cc1c81227a5027da0da95336..a5c2d605dff6f91df4130c2ff02d09919bae6974 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,15 +9,15 @@ import Foundation open class PetstoreClientAPI { public static var basePath = "http://petstore.swagger.io:80/v2" public static var credential: URLCredential? - public static var customHeaders: [String:String] = [:] + public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder<T> { var credential: URLCredential? - var headers: [String:String] - public let parameters: [String:Any]? + var headers: [String: String] + public let parameters: [String: Any]? public let isBody: Bool public let method: String public let URLString: String @@ -25,9 +25,9 @@ open class RequestBuilder<T> { /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. /// If you need to get the request's progress in older OS versions, please use Alamofire http client. - public var onProgressReady: ((Progress) -> ())? + public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -37,7 +37,7 @@ open class RequestBuilder<T> { addHeaders(PetstoreClientAPI.customHeaders) } - open func addHeaders(_ aHeaders:[String:String]) { + open func addHeaders(_ aHeaders: [String: String]) { for (header, value) in aHeaders { headers[header] = value } @@ -60,5 +60,5 @@ open class RequestBuilder<T> { public protocol RequestBuilderFactory { func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index bb3ae717825412b9adeed7bb5ddda32ea74185ec..5bbf323f820cd3132cf60e1d11dbf21e55944156 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class AnotherFakeAPI { /** To test special tags @@ -17,7 +15,7 @@ open class AnotherFakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index d1d81faa335c4ea18856b16a52b2ee7cc0054f3a..134d6aea416a97039b668ee963e2c53f0df2d6d3 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class FakeAPI { /** @@ -16,7 +14,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?,_ error: Error?) -> Void)) { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) { fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -51,7 +49,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) { fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -86,7 +84,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?,_ error: Error?) -> Void)) { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) { fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -121,7 +119,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -156,7 +154,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -192,7 +190,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -231,7 +229,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -281,7 +279,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -318,7 +316,7 @@ open class FakeAPI { open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), @@ -337,7 +335,7 @@ open class FakeAPI { let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -426,7 +424,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -454,19 +452,19 @@ open class FakeAPI { open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "enum_form_string_array": enumFormStringArray?.encodeToJSON(), "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), - "enum_query_string": enumQueryString?.encodeToJSON(), - "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -492,7 +490,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -518,13 +516,13 @@ open class FakeAPI { open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": requiredStringGroup.encodeToJSON(), - "required_int64_group": requiredInt64Group.encodeToJSON(), - "string_group": stringGroup?.encodeToJSON(), + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -545,7 +543,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testInlineAdditionalProperties(param: [String:String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -562,7 +560,7 @@ open class FakeAPI { - parameter param: (body) request body - returns: RequestBuilder<Void> */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> { let path = "/fake/inline-additionalProperties" let URLString = PetstoreClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) @@ -582,7 +580,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -603,14 +601,14 @@ open class FakeAPI { open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "param": param.encodeToJSON(), "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index d21c4a49d43d099eaa7ffc901ca9ff1884235915..48cfe7187b9a6740385db65efbbdef7fb6164a7f 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -7,8 +7,6 @@ import Foundation - - open class FakeClassnameTags123API { /** To test class name in snake case @@ -17,7 +15,7 @@ open class FakeClassnameTags123API { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index f5366f5832baf471018f15f4d04882347e77df85..c938db7200472ab06b8c2f0a29c7660aec7cb118 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class PetAPI { /** Add a new pet to the store @@ -17,7 +15,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -57,7 +55,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -84,8 +82,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ "api_key": apiKey?.encodeToJSON() @@ -113,7 +111,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -137,8 +135,8 @@ open class PetAPI { open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "status": status.encodeToJSON() @@ -157,7 +155,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -182,8 +180,8 @@ open class PetAPI { open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "tags": tags.encodeToJSON() @@ -201,7 +199,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?,_ error: Error?) -> Void)) { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) { getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,8 +226,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -244,7 +242,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -285,7 +283,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -313,14 +311,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "name": name?.encodeToJSON(), "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -337,7 +335,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -365,14 +363,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -389,7 +387,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -417,14 +415,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 3848eda85ad69cbca414345076b6c6a1eeea6bc3..a8a83eda39a4e7ee3a7cc86e3ce0d0bc26e7182c 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class StoreAPI { /** Delete purchase order by ID @@ -17,7 +15,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -41,8 +39,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -56,7 +54,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String:Int]?,_ error: Error?) -> Void)) { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) { getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -76,14 +74,14 @@ open class StoreAPI { - name: api_key - returns: RequestBuilder<[String:Int]> */ - open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { let path = "/store/inventory" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } @@ -95,7 +93,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -119,8 +117,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -135,7 +133,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 546166841d9e6987c83402f734038868be6c3997..505ed1b0c5c9995b0bc45aa233212d11a8e515e9 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class UserAPI { /** Create user @@ -17,7 +15,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -54,7 +52,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -90,7 +88,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -126,7 +124,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -150,8 +148,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -166,7 +164,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?,_ error: Error?) -> Void)) { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) { getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -189,8 +187,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -206,7 +204,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,11 +226,11 @@ open class UserAPI { open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username.encodeToJSON(), + "username": username.encodeToJSON(), "password": password.encodeToJSON() ]) @@ -247,7 +245,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -266,8 +264,8 @@ open class UserAPI { open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -283,7 +281,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 01b28a4bd42d21245b26f53ba2766a44c3ff0d38..ef971ebadc60ae1d358d9d87e8727aa13ec7437b 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -45,4 +45,4 @@ open class CodableHelper { open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { return Swift.Result { try self.jsonEncoder.encode(value) } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift index f171525e43944f9cedf0e5146a39752fc2e848dc..627d9adb757ef30f3bf44723748aee6b5f1913d9 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,10 +7,10 @@ import Foundation open class Configuration { - + // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} \ No newline at end of file + +} 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 6e279679c67a1e7e3f302fc0fcbfd5b58a6dd12f..93ed6b90b376a7b84e9eabb1705f3dcb8bd98a14 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -108,24 +108,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { if let values = values { try encodeArray(values, forKey: key) } } - public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable { + public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable { + public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { - var tmpArray: [T]? = nil + public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? if contains(key) { tmpArray = try decodeArray(T.self, forKey: key) @@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable { - var map: [Self.Key : T] = [:] + public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -177,5 +177,3 @@ extension HTTPURLResponse { return Array(200 ..< 300).contains(statusCode) } } - - diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift index 08f1ef334dff10656c28e298c6b9b6d754159d73..b79e9f5e64d518e51552c62467884931ee1eaf3c 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -41,7 +41,7 @@ public struct JSONDataEncoding { } public static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? = nil + var returnedParams: [String: Any]? if let jsonData = jsonData, !jsonData.isEmpty { var params: [String: Any] = [:] params[jsonDataKey] = jsonData diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 314f1eff1f9b07d17db1930bfbe566baedbbc5cc..02f78ffb47056ddebac110679c4b545ed2861125 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -9,8 +9,8 @@ import Foundation open class JSONEncodingHelper { - open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? = nil + open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? // Encode the Encodable object if let encodableObj = encodableObj { @@ -27,7 +27,7 @@ open class JSONEncodingHelper { } open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? = nil + var params: [String: Any]? if let encodableObj = encodableObj { do { @@ -41,5 +41,5 @@ open class JSONEncodingHelper { return params } - + } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift index 11e81ffcc472bbe9ca94aecdf5b731470979d0de..c0542c14c0812d73834b48ba2123704b096bd61c 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,11 +10,11 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse : Error { +public enum ErrorResponse: Error { case error(Int, Data?, Error) } -public enum DownloadException : Error { +public enum DownloadException: Error { case responseDataMissing case responseFailed case requestMissing @@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error { case generalError(Error) } - open class Response<T> { public let statusCode: Int public let header: [String: String] @@ -44,7 +43,7 @@ open class Response<T> { public convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String:String]() + var header = [String: String]() for (key, value) in rawHeader { if let key = key.base as? String, let value = value as? String { header[key] = value diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 28ca8377b889b8436d0d11797c89daaa27864e9f..1af0315359678116da5f18a94457d0d2a1178e51 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,19 +7,17 @@ import Foundation +public struct AdditionalPropertiesClass: Codable { -public struct AdditionalPropertiesClass: Codable { + public var mapString: [String: String]? + public var mapMapString: [String: [String: String]]? - - public var mapString: [String:String]? - public var mapMapString: [String:[String:String]]? - - public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { + public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { self.mapString = mapString self.mapMapString = mapMapString } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapString = "map_string" case mapMapString = "map_map_string" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index 1050d79dbe9df42e68f40f036c83f858d3cfd441..5ed9f31e2a364d0bf7a25bdf70cecb48af6ab5c4 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Animal: Codable { - +public struct Animal: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift index e7bea63f8ed28132865ea4d3c23eab55666cf4f6..e09b0e9efdc8ca7798114f24aff21f57e8f9fabd 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -7,5 +7,4 @@ import Foundation - public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index 4d0393b9ba45fb26499017214280bf04637ebe09..ec270da8907438877ee5cc303b093ceba3993297 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ApiResponse: Codable { - +public struct ApiResponse: Codable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 1363c96394baf0514e28045c00399b49591a962d..6c252ed475b2ed17ed9cd5a9eee4db0348886338 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfArrayOfNumberOnly: Codable { - +public struct ArrayOfArrayOfNumberOnly: Codable { public var arrayArrayNumber: [[Double]]? @@ -17,7 +15,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable { self.arrayArrayNumber = arrayArrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayArrayNumber = "ArrayArrayNumber" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index 6b8873730c43cabe3911148ca8edc15b468d0a17..e84eb5d650258b37fdd423fadcfe1c7fc63962df 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfNumberOnly: Codable { - +public struct ArrayOfNumberOnly: Codable { public var arrayNumber: [Double]? @@ -17,7 +15,7 @@ public struct ArrayOfNumberOnly: Codable { self.arrayNumber = arrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayNumber = "ArrayNumber" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index 64f7c6d9db99f4927f985c425f33a0d435c7d701..d2140933d1817725be708b41da4e996a549f3896 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayTest: Codable { - +public struct ArrayTest: Codable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? @@ -21,7 +19,7 @@ public struct ArrayTest: Codable { self.arrayArrayOfModel = arrayArrayOfModel } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayOfString = "array_of_string" case arrayArrayOfInteger = "array_array_of_integer" case arrayArrayOfModel = "array_array_of_model" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index ddb669a590459e81909408e9d2d9bc40dadfd38e..d1b3b27616edc9a2da27adb54c6b95ce056f8e91 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Capitalization: Codable { - +public struct Capitalization: Codable { public var smallCamel: String? public var capitalCamel: String? @@ -28,7 +26,7 @@ public struct Capitalization: Codable { self.ATT_NAME = ATT_NAME } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case smallCamel case capitalCamel = "CapitalCamel" case smallSnake = "small_Snake" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index c4f6e0d488caad736393f8a8936e5db63fec5378..7ab887f3113f1dd39f42b1019d8f58d45325f288 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Cat: Codable { - +public struct Cat: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift index 7b1d7e32be80ed62c3c1dda290093a4ea02a6c7b..a51ad0dffab1ba129591056cd816575af0e1ea09 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct CatAllOf: Codable { - +public struct CatAllOf: Codable { public var declawed: Bool? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 3ec00f5ab10d19c5cd961c6316c9ec7960a85c57..eb8f7e5e1974989058473e4492c25c0004f1078c 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Category: Codable { - +public struct Category: Codable { public var id: Int64? public var name: String = "default-name" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index af030c3dd6269b59f42af7280976d3fa9dee9425..e2a7d4427a061dd104df50c1922ab1446e549106 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Codable { - +public struct ClassModel: Codable { public var _class: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index 0aae748c76b4398015bcac633f082d0fbd84531a..00245ca37280eea9c87184eb0f40fb8bf03b81f2 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Client: Codable { - +public struct Client: Codable { public var client: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 198e28b94dd6615a5da1b5c9efd0e13c3150de4a..492c1228008eb782ea0f927f65259ce2c7999d24 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Dog: Codable { - +public struct Dog: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift index 8ff49b2af23fc129b73f3bfc3e4c8a6d95b16ea5..7786f8acc5ae7d0de7de7248ef5a94d4d16f0a17 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct DogAllOf: Codable { - +public struct DogAllOf: Codable { public var breed: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index e2d3fa04f94b92473f218965cf21bb8eb8e82ee2..9844e7c40e35868546bb256fd806eb8b30b135f2 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumArrays: Codable { - +public struct EnumArrays: Codable { public enum JustSymbol: String, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -27,7 +25,7 @@ public struct EnumArrays: Codable { self.arrayEnum = arrayEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justSymbol = "just_symbol" case arrayEnum = "array_enum" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift index c2c639ba3246c2c7d30830770fc80529114eca31..d4029d73f8aff2b20baf7856bb6517a1407731b5 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -7,7 +7,6 @@ import Foundation - public enum EnumClass: String, Codable, CaseIterable { case abc = "_abc" case efg = "-efg" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index a56e1f36389b91b5bf92522d6248b9fc69d3c386..789f583e1d778b6b26d6270fe386e3b88b406488 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumTest: Codable { - +public struct EnumTest: Codable { public enum EnumString: String, Codable, CaseIterable { case upper = "UPPER" @@ -43,7 +41,7 @@ public struct EnumTest: Codable { self.outerEnum = outerEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case enumString = "enum_string" case enumStringRequired = "enum_string_required" case enumInteger = "enum_integer" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift index 773b53b2cb765586e3a14e4034a7c8da7a177363..abf3ccffc48588b98475607b17878c7d03320f48 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,8 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Codable { - +public struct File: Codable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 83dc1148cfa3d6e9bbcb2d78f2d62b38045668b6..532f1457939af300b65f89821673cf1951ec2f0b 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FileSchemaTestClass: Codable { - +public struct FileSchemaTestClass: Codable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index bccd3f9fb1786b11e4d4dc8e97ca6bd3e73f4cab..20bd6d103b3dc87ffa6d7f38b21d957318628930 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FormatTest: Codable { - +public struct FormatTest: Codable { public var integer: Int? public var int32: Int? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index 566d71a35ef0193c3e0ca140a6adabfcdc84588f..906ddb06fb170e5de30f07754fce3efc4f512ee1 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct HasOnlyReadOnly: Codable { - +public struct HasOnlyReadOnly: Codable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 80cecab242f25976c3ac5b7538ca07f7d1a1e1b8..fe13d302ccbfde321339be7d09f6932248c2570e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,9 +7,7 @@ import Foundation - -public struct List: Codable { - +public struct List: Codable { public var _123list: String? @@ -17,7 +15,7 @@ public struct List: Codable { self._123list = _123list } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _123list = "123-list" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index f0c02de95f7abe0f4bd7fac695d9c590120d8504..4b6037f378ee6b0152805f8b11d374a16373e222 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,27 +7,25 @@ import Foundation - -public struct MapTest: Codable { - +public struct MapTest: Codable { public enum MapOfEnumString: String, Codable, CaseIterable { case upper = "UPPER" case lower = "lower" } - public var mapMapOfString: [String:[String:String]]? - public var mapOfEnumString: [String:String]? - public var directMap: [String:Bool]? + public var mapMapOfString: [String: [String: String]]? + public var mapOfEnumString: [String: String]? + public var directMap: [String: Bool]? public var indirectMap: StringBooleanMap? - public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) { + public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { self.mapMapOfString = mapMapOfString self.mapOfEnumString = mapOfEnumString self.directMap = directMap self.indirectMap = indirectMap } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapMapOfString = "map_map_of_string" case mapOfEnumString = "map_of_enum_string" case directMap = "direct_map" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 710e62a9b5875c830a4885dac70b0bedb56d32b2..c3deb2f28932f5d0ab338f3da2ac398de24a8822 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,15 +7,13 @@ import Foundation - -public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { - +public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { public var uuid: UUID? public var dateTime: Date? - public var map: [String:Animal]? + public var map: [String: Animal]? - public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) { + public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { self.uuid = uuid self.dateTime = dateTime self.map = map diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index 450a53b918ca0d82e9697268575f6315bd76e1c7..b61db7d6e716185b1b6f21ac2c536f3d5e408809 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Codable { - +public struct Model200Response: Codable { public var name: Int? public var _class: String? @@ -19,7 +18,7 @@ public struct Model200Response: Codable { self._class = _class } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case _class = "class" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index 6deb69fcd7313698cb05f790654c47f98a303665..8ab4db44b73a3726cc854651fef382bd9fcf69b6 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Codable { - +public struct Name: Codable { public var name: Int public var snakeCase: Int? @@ -23,7 +22,7 @@ public struct Name: Codable { self._123number = _123number } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case snakeCase = "snake_case" case property diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 0c9ee2b7b9f4a7fcd3a7c1ed1e142e8fcce4cf84..4d1dafcc2c1f56bf9c7e317734efc71ee9fbd09a 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct NumberOnly: Codable { - +public struct NumberOnly: Codable { public var justNumber: Double? @@ -17,7 +15,7 @@ public struct NumberOnly: Codable { self.justNumber = justNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justNumber = "JustNumber" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index ab0eac0b304e4a248aa897d86579bde395947b77..40c30cc8609c33fd59240aae30ba7d942e4d3659 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Order: Codable { - +public struct Order: Codable { public enum Status: String, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 4a7d227104413d7065789fa87b4c2f41078130a0..18c3a024f1227af549fb1b13b1838f1e81a837b1 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,9 +7,7 @@ import Foundation - -public struct OuterComposite: Codable { - +public struct OuterComposite: Codable { public var myNumber: Double? public var myString: String? @@ -21,7 +19,7 @@ public struct OuterComposite: Codable { self.myBoolean = myBoolean } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case myNumber = "my_number" case myString = "my_string" case myBoolean = "my_boolean" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift index 9e6b8d74e874c1d75bf8afbb92296996e39cf366..c3b778cbbed444c54045dedb48213ce3bb532dbf 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -7,7 +7,6 @@ import Foundation - public enum OuterEnum: String, Codable, CaseIterable { case placed = "placed" case approved = "approved" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index a973071d6c9615c7e082183ec555eb794bb11b3b..b9ce0e933256c401ced1143aaa31936cf60bdb63 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Pet: Codable { - +public struct Pet: Codable { public enum Status: String, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index b2a6b7e2b8a61e14c75f22de2da766e96afc1fca..0acd21fd10000317ffc9f96840a49b3dd538d0c7 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ReadOnlyFirst: Codable { - +public struct ReadOnlyFirst: Codable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index 7e089dcee2b4a366353619ee201eb067bb63ed71..c223f993a69ece3abf5451c68d01eb666dad5b19 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Codable { - +public struct Return: Codable { public var _return: Int? @@ -17,7 +16,7 @@ public struct Return: Codable { self._return = _return } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _return = "return" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index e890ef952520010cb37b71b4f4c06215b4f7c88c..6e8650f76d8ece4a8511cf0afacf62816e852598 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,9 +7,7 @@ import Foundation - -public struct SpecialModelName: Codable { - +public struct SpecialModelName: Codable { public var specialPropertyName: Int64? @@ -17,7 +15,7 @@ public struct SpecialModelName: Codable { self.specialPropertyName = specialPropertyName } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case specialPropertyName = "$special[property.name]" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index f65ae0623d6e8567ed17f651d3c0ff056fefb1ba..3f1237fee477a298b1d99cef8062371e2f101f59 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,12 +7,9 @@ import Foundation +public struct StringBooleanMap: Codable { -public struct StringBooleanMap: Codable { - - - - public var additionalProperties: [String:Bool] = [:] + public var additionalProperties: [String: Bool] = [:] public subscript(key: String) -> Bool? { get { @@ -45,5 +42,4 @@ public struct StringBooleanMap: Codable { additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index a91b6061bcf78c8ad31d4ae87401afa4ac72330b..4dd8a9a9f5a0fc547c88401b39caf0f00cddd61d 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Tag: Codable { - +public struct Tag: Codable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index 2d377c3edb02c59cbf82ae4bc9534eba7c3f3e2b..a9e088808ed378dfa9690f8dfa1fc687294bd3bd 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderDefault: Codable { - +public struct TypeHolderDefault: Codable { public var stringItem: String = "what" public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderDefault: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index e5eb92da696e19c998edd122f874f9f7fa776148..dff4083ae43260c42e61413843b52749b26b6769 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderExample: Codable { - +public struct TypeHolderExample: Codable { public var stringItem: String public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderExample: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift index f70328ca9e597ffca3abc70b5340fda99848a4d1..79f271ed73564b8af07f2698e649f38062255ce7 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,9 +7,7 @@ import Foundation - -public struct User: Codable { - +public struct User: Codable { public var id: Int64? public var username: String? 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 22261e2ce9483f4ac59c12ff516a53863a606132..55d0eb42191942998769644daea74ffeb51cbcd7 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -14,7 +14,7 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { return URLSessionRequestBuilder<T>.self } - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type { + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { return URLSessionDecodableRequestBuilder<T>.self } } @@ -23,16 +23,16 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { private var urlSessionStore = SynchronizedDictionary<String, URLSession>() open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - + private var observation: NSKeyValueObservation? - + deinit { observation?.invalidate() } - + // swiftlint:disable:next weak_delegate fileprivate let sessionDelegate = SessionDelegate() - + /** May be assigned if you want to control the authentication challenges. */ @@ -45,11 +45,11 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - retry the request. */ public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? - - required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { + + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } - + /** May be overridden by a subclass if you want to control the URLSession configuration. @@ -77,40 +77,40 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { May be overridden by a subclass if you want to control the URLRequest configuration (e.g. to override the cache policy). */ - open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) throws -> URLRequest { - + open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { + guard let url = URL(string: URLString) else { throw DownloadException.requestMissingURL } - + var originalRequest = URLRequest(url: url) - + originalRequest.httpMethod = method.rawValue - + buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + headers.forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) - + return modifiedRequest } override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { - let urlSessionId:String = UUID().uuidString + let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() urlSessionStore[urlSessionId] = urlSession - + let parameters: [String: Any] = self.parameters ?? [:] - + let fileKeys = parameters.filter { $1 is URL } .map { $0.0 } - + let encoding: ParameterEncoding if fileKeys.count > 0 { encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) @@ -119,29 +119,29 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } else { encoding = URLEncoding() } - + guard let xMethod = HTTPMethod(rawValue: method) else { fatalError("Unsuported Http method - \(method)") } - + let cleanupRequest = { urlSessionStore[urlSessionId] = nil self.observation?.invalidate() } - + do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - + let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - + guard let self = self else { return } - + if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - + taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - + guard let self = self else { return } - + if shouldRetry { cleanupRequest() self.execute(apiResponseQueue, completion) @@ -157,13 +157,13 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } } - + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { onProgressReady?(dataTask.progress) } - + dataTask.resume() - + } catch { apiResponseQueue.async { cleanupRequest() @@ -172,7 +172,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } - + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -192,52 +192,52 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is URL.Type: do { - + guard error == nil else { throw DownloadException.responseFailed } - + guard let data = data else { throw DownloadException.responseDataMissing } - + let fileManager = FileManager.default let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] let requestURL = try self.getURL(from: urlRequest) - + var requestPath = try self.getPath(from: requestURL) - + if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { requestPath = requestPath.appending("/\(headerFileName)") } - + let filePath = documentsDirectory.appendingPathComponent(requestPath) let directoryPath = filePath.deletingLastPathComponent().path - + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) - + completion(.success(Response(response: httpResponse, body: filePath as? T))) - + } catch let requestParserError as DownloadException { completion(.failure(ErrorResponse.error(400, data, requestParserError))) } catch let error { completion(.failure(ErrorResponse.error(400, data, error))) } - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + default: - + completion(.success(Response(response: httpResponse, body: data as? T))) } @@ -251,7 +251,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { guard let contentDisposition = contentDisposition else { return nil @@ -270,7 +270,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { filename = contentItem return filename? - .replacingCharacters(in: range, with:"") + .replacingCharacters(in: range, with: "") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } @@ -279,7 +279,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getPath(from url : URL) throws -> String { + fileprivate func getPath(from url: URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath @@ -293,7 +293,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL @@ -304,7 +304,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } -open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuilder<T> { +open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -324,28 +324,28 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + case is Data.Type: - + completion(.success(Response(response: httpResponse, body: data as? T))) - + default: - + guard let data = data, !data.isEmpty else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse))) return } - + let decodeResult = CodableHelper.decode(T.self, from: data) - + switch decodeResult { case let .success(decodableObj): completion(.success(Response(response: httpResponse, body: decodableObj))) @@ -356,10 +356,10 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil } } -fileprivate class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { - +private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { + var credential: URLCredential? - + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { @@ -402,13 +402,13 @@ public protocol ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest } -fileprivate class URLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) throws -> URLRequest { - +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - + guard let parameters = parameters else { return urlRequest } - + guard let url = urlRequest.url else { throw DownloadException.requestMissingURL } @@ -417,12 +417,12 @@ fileprivate class URLEncoding: ParameterEncoding { urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) urlRequest.url = urlComponents.url } - + return urlRequest } } -fileprivate class FileUploadEncoding: ParameterEncoding { +private class FileUploadEncoding: ParameterEncoding { let contentTypeForFormPart: (_ fileURL: URL) -> String? @@ -433,13 +433,13 @@ fileprivate class FileUploadEncoding: ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { var urlRequest = urlRequest - + guard let parameters = parameters, !parameters.isEmpty else { return urlRequest } - + let boundary = "Boundary-\(UUID().uuidString)" - + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") for (key, value) in parameters { @@ -479,7 +479,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { fatalError("Unprocessable value \(value) with key \(key)") } } - + var body = urlRequest.httpBody.orEmpty body.append("\r\n--\(boundary)--\r\n") @@ -494,7 +494,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { var urlRequest = urlRequest var body = urlRequest.httpBody.orEmpty - + let fileData = try Data(contentsOf: fileURL) let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) @@ -502,7 +502,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } @@ -518,20 +518,20 @@ fileprivate class FileUploadEncoding: ParameterEncoding { // The value data. body.append(fileData) - + urlRequest.httpBody = body return urlRequest } - + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { var urlRequest = urlRequest - + var body = urlRequest.httpBody.orEmpty // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } diff --git a/samples/client/petstore/swift5/deprecated/Package.swift b/samples/client/petstore/swift5/deprecated/Package.swift index 79f6f81887383d4539292942c364aed2cfcfb5c6..96dfff54edf415c3c22de54b2758012c629b6f79 100644 --- a/samples/client/petstore/swift5/deprecated/Package.swift +++ b/samples/client/petstore/swift5/deprecated/Package.swift @@ -14,7 +14,7 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "PetstoreClient", - targets: ["PetstoreClient"]), + targets: ["PetstoreClient"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -26,6 +26,6 @@ let package = Package( name: "PetstoreClient", dependencies: [], path: "PetstoreClient/Classes" - ), + ) ] ) diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 2404bc8ffc6d6a190b82327193d4b5b2325dd515..5b09f9557113d4bc4d0ca8b0b05b4f408008c2ff 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,7 +7,7 @@ import Foundation public struct APIHelper { - public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,17 +20,17 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? Array<Any?> { - result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" } } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { guard let source = source else { return nil } @@ -46,15 +46,15 @@ public struct APIHelper { } public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? Array<Any?> { + if let collection = source as? [Any?] { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? Array<Any?> { + if let collection = item.value as? [Any?] { collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in result.append(URLQueryItem(name: item.key, value: value)) } @@ -69,4 +69,3 @@ public struct APIHelper { return destination } } - diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs.swift index 92d547e0d69d10bd144dce0fb3dbfc592fb48aaa..74babd69f97ce699cae4f32dcc01263b1e13f324 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,15 +9,15 @@ import Foundation open class PetstoreClientAPI { public static var basePath = "http://petstore.swagger.io/v2" public static var credential: URLCredential? - public static var customHeaders: [String:String] = [:] + public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder<T> { var credential: URLCredential? - var headers: [String:String] - public let parameters: [String:Any]? + var headers: [String: String] + public let parameters: [String: Any]? public let isBody: Bool public let method: String public let URLString: String @@ -25,9 +25,9 @@ open class RequestBuilder<T> { /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. /// If you need to get the request's progress in older OS versions, please use Alamofire http client. - public var onProgressReady: ((Progress) -> ())? + public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -37,7 +37,7 @@ open class RequestBuilder<T> { addHeaders(PetstoreClientAPI.customHeaders) } - open func addHeaders(_ aHeaders:[String:String]) { + open func addHeaders(_ aHeaders: [String: String]) { for (header, value) in aHeaders { headers[header] = value } @@ -60,5 +60,5 @@ open class RequestBuilder<T> { public protocol RequestBuilderFactory { func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type } diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index dbbbd66db265afe1dbbbc2680922bb325e81ec2d..06a266aab47cdcfba34e82bfdf7d8c0716fd7513 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class PetAPI { /** Add a new pet to the store @@ -17,7 +15,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func addPet(pet: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func addPet(pet: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { addPetWithRequestBuilder(pet: pet).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -57,7 +55,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -84,8 +82,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ "api_key": apiKey?.encodeToJSON() @@ -113,7 +111,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -137,8 +135,8 @@ open class PetAPI { open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "status": status.encodeToJSON() @@ -157,7 +155,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -182,8 +180,8 @@ open class PetAPI { open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "tags": tags.encodeToJSON() @@ -201,7 +199,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?,_ error: Error?) -> Void)) { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) { getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,8 +226,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -244,7 +242,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePet(pet: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePet(pet: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithRequestBuilder(pet: pet).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -285,7 +283,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -313,14 +311,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "name": name?.encodeToJSON(), "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -337,7 +335,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -365,14 +363,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 16fb9c207a4fa36a0b5675f9c131b79084f822c3..ff110015954205a67634d492362aabfbaccff66c 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class StoreAPI { /** Delete purchase order by ID @@ -17,7 +15,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -41,8 +39,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{orderId}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -56,7 +54,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String:Int]?,_ error: Error?) -> Void)) { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) { getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -76,14 +74,14 @@ open class StoreAPI { - name: api_key - returns: RequestBuilder<[String:Int]> */ - open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { let path = "/store/inventory" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } @@ -95,7 +93,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -119,8 +117,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{orderId}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -135,7 +133,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func placeOrder(order: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func placeOrder(order: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { placeOrderWithRequestBuilder(order: order).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 8220640259af3088198f08169c1cbf09a5655bcc..04a9b99643c0ff02296d19b2a3844593d586913c 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class UserAPI { /** Create user @@ -17,7 +15,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUser(user: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUser(user: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUserWithRequestBuilder(user: user).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -57,7 +55,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithArrayInput(user: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithArrayInput(user: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithArrayInputWithRequestBuilder(user: user).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -96,7 +94,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithListInput(user: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithListInput(user: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithListInputWithRequestBuilder(user: user).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -135,7 +133,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -162,8 +160,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -178,7 +176,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?,_ error: Error?) -> Void)) { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) { getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -201,8 +199,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -218,7 +216,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -240,11 +238,11 @@ open class UserAPI { open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username.encodeToJSON(), + "username": username.encodeToJSON(), "password": password.encodeToJSON() ]) @@ -259,7 +257,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -281,8 +279,8 @@ open class UserAPI { open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -298,7 +296,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updateUser(username: String, user: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updateUser(username: String, user: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updateUserWithRequestBuilder(username: username, user: user).execute(apiResponseQueue) { result -> Void in switch result { case .success: diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 01b28a4bd42d21245b26f53ba2766a44c3ff0d38..ef971ebadc60ae1d358d9d87e8727aa13ec7437b 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -45,4 +45,4 @@ open class CodableHelper { open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { return Swift.Result { try self.jsonEncoder.encode(value) } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Configuration.swift index f171525e43944f9cedf0e5146a39752fc2e848dc..627d9adb757ef30f3bf44723748aee6b5f1913d9 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,10 +7,10 @@ import Foundation open class Configuration { - + // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} \ No newline at end of file + +} 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 6e279679c67a1e7e3f302fc0fcbfd5b58a6dd12f..93ed6b90b376a7b84e9eabb1705f3dcb8bd98a14 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -108,24 +108,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { if let values = values { try encodeArray(values, forKey: key) } } - public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable { + public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable { + public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { - var tmpArray: [T]? = nil + public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? if contains(key) { tmpArray = try decodeArray(T.self, forKey: key) @@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable { - var map: [Self.Key : T] = [:] + public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -177,5 +177,3 @@ extension HTTPURLResponse { return Array(200 ..< 300).contains(statusCode) } } - - diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift index 08f1ef334dff10656c28e298c6b9b6d754159d73..b79e9f5e64d518e51552c62467884931ee1eaf3c 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -41,7 +41,7 @@ public struct JSONDataEncoding { } public static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? = nil + var returnedParams: [String: Any]? if let jsonData = jsonData, !jsonData.isEmpty { var params: [String: Any] = [:] params[jsonDataKey] = jsonData diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 314f1eff1f9b07d17db1930bfbe566baedbbc5cc..02f78ffb47056ddebac110679c4b545ed2861125 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -9,8 +9,8 @@ import Foundation open class JSONEncodingHelper { - open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? = nil + open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? // Encode the Encodable object if let encodableObj = encodableObj { @@ -27,7 +27,7 @@ open class JSONEncodingHelper { } open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? = nil + var params: [String: Any]? if let encodableObj = encodableObj { do { @@ -41,5 +41,5 @@ open class JSONEncodingHelper { return params } - + } diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models.swift index 11e81ffcc472bbe9ca94aecdf5b731470979d0de..c0542c14c0812d73834b48ba2123704b096bd61c 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,11 +10,11 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse : Error { +public enum ErrorResponse: Error { case error(Int, Data?, Error) } -public enum DownloadException : Error { +public enum DownloadException: Error { case responseDataMissing case responseFailed case requestMissing @@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error { case generalError(Error) } - open class Response<T> { public let statusCode: Int public let header: [String: String] @@ -44,7 +43,7 @@ open class Response<T> { public convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String:String]() + var header = [String: String]() for (key, value) in rawHeader { if let key = key.base as? String, let value = value as? String { header[key] = value diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index cab2fbb07782660de2321ec7e80e57f7319362bd..e74820fd28acf1cb8f37770b01a951b8334534ae 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -8,8 +8,7 @@ import Foundation /** Describes the result of uploading an image resource */ -public struct ApiResponse: Codable { - +public struct ApiResponse: Codable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 7006e56507f56a1f09d1a404b7e3ba81588c5210..fec18cc7a6c79919d444e3b1a85704c1312ce96f 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -8,8 +8,7 @@ import Foundation /** A category for a pet */ -public struct Category: Codable { - +public struct Category: Codable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/InlineObject.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/InlineObject.swift index 1c8072f6bada86e0d9e59601dcbb7f01d4029089..ac5216fe68760498c9f548a79ae005be41a75fdb 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/InlineObject.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/InlineObject.swift @@ -7,9 +7,7 @@ import Foundation - -public struct InlineObject: Codable { - +public struct InlineObject: Codable { /** Updated name of the pet */ public var name: String? diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/InlineObject1.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/InlineObject1.swift index fa806b07294dedc0d6e9098e3dfb2bc817bd3d49..1c2fd3255dd17d61b0b981ff04085657844d90c7 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/InlineObject1.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/InlineObject1.swift @@ -7,9 +7,7 @@ import Foundation - -public struct InlineObject1: Codable { - +public struct InlineObject1: Codable { /** Additional data to pass to server */ public var additionalMetadata: String? diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index 1adf3d7acc7e6400759dd107de75df11e87af8fe..1fa6995d1c7b1f5c5bffb6b38f89add7e54a8ca6 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -9,8 +9,7 @@ import Foundation /** An order for a pets from the pet store */ @available(*, deprecated, message: "This schema is deprecated.") -public struct Order: Codable { - +public struct Order: Codable { public enum Status: String, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index ffd5eb5d91657095b7ca872f964dede146456ce6..622f2c9bd4328e507503ef4cf49e2469d72a6b3d 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -8,8 +8,7 @@ import Foundation /** A pet for sale in the pet store */ -public struct Pet: Codable { - +public struct Pet: Codable { public enum Status: String, Codable, CaseIterable { case available = "available" @@ -19,7 +18,7 @@ public struct Pet: Codable { public var id: Int64? public var category: Category? public var name: String? - + @available(*, deprecated, message: "This property is deprecated.") public var photoUrls: [String] public var tags: [Tag]? diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 55993174744ae2cfe58e1f4f50a2a4f9f984db98..98a78982e59209ab0e8ac73f3cf902f925b1f0cf 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -8,8 +8,7 @@ import Foundation /** A tag for a pet */ -public struct Tag: Codable { - +public struct Tag: Codable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/User.swift index ddf682b7dde23c53b4e86e3f10e2b6aa465396d3..4e42f6f28595e0fe546f55e94873af47e2e3b9d7 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -8,8 +8,7 @@ import Foundation /** A User who is purchasing from the pet store */ -public struct User: Codable { - +public struct User: Codable { public var id: Int64? public var username: String? 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 22261e2ce9483f4ac59c12ff516a53863a606132..55d0eb42191942998769644daea74ffeb51cbcd7 100644 --- a/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/deprecated/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -14,7 +14,7 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { return URLSessionRequestBuilder<T>.self } - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type { + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { return URLSessionDecodableRequestBuilder<T>.self } } @@ -23,16 +23,16 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { private var urlSessionStore = SynchronizedDictionary<String, URLSession>() open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - + private var observation: NSKeyValueObservation? - + deinit { observation?.invalidate() } - + // swiftlint:disable:next weak_delegate fileprivate let sessionDelegate = SessionDelegate() - + /** May be assigned if you want to control the authentication challenges. */ @@ -45,11 +45,11 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - retry the request. */ public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? - - required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { + + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } - + /** May be overridden by a subclass if you want to control the URLSession configuration. @@ -77,40 +77,40 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { May be overridden by a subclass if you want to control the URLRequest configuration (e.g. to override the cache policy). */ - open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) throws -> URLRequest { - + open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { + guard let url = URL(string: URLString) else { throw DownloadException.requestMissingURL } - + var originalRequest = URLRequest(url: url) - + originalRequest.httpMethod = method.rawValue - + buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + headers.forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) - + return modifiedRequest } override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { - let urlSessionId:String = UUID().uuidString + let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() urlSessionStore[urlSessionId] = urlSession - + let parameters: [String: Any] = self.parameters ?? [:] - + let fileKeys = parameters.filter { $1 is URL } .map { $0.0 } - + let encoding: ParameterEncoding if fileKeys.count > 0 { encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) @@ -119,29 +119,29 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } else { encoding = URLEncoding() } - + guard let xMethod = HTTPMethod(rawValue: method) else { fatalError("Unsuported Http method - \(method)") } - + let cleanupRequest = { urlSessionStore[urlSessionId] = nil self.observation?.invalidate() } - + do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - + let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - + guard let self = self else { return } - + if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - + taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - + guard let self = self else { return } - + if shouldRetry { cleanupRequest() self.execute(apiResponseQueue, completion) @@ -157,13 +157,13 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } } - + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { onProgressReady?(dataTask.progress) } - + dataTask.resume() - + } catch { apiResponseQueue.async { cleanupRequest() @@ -172,7 +172,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } - + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -192,52 +192,52 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is URL.Type: do { - + guard error == nil else { throw DownloadException.responseFailed } - + guard let data = data else { throw DownloadException.responseDataMissing } - + let fileManager = FileManager.default let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] let requestURL = try self.getURL(from: urlRequest) - + var requestPath = try self.getPath(from: requestURL) - + if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { requestPath = requestPath.appending("/\(headerFileName)") } - + let filePath = documentsDirectory.appendingPathComponent(requestPath) let directoryPath = filePath.deletingLastPathComponent().path - + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) - + completion(.success(Response(response: httpResponse, body: filePath as? T))) - + } catch let requestParserError as DownloadException { completion(.failure(ErrorResponse.error(400, data, requestParserError))) } catch let error { completion(.failure(ErrorResponse.error(400, data, error))) } - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + default: - + completion(.success(Response(response: httpResponse, body: data as? T))) } @@ -251,7 +251,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { guard let contentDisposition = contentDisposition else { return nil @@ -270,7 +270,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { filename = contentItem return filename? - .replacingCharacters(in: range, with:"") + .replacingCharacters(in: range, with: "") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } @@ -279,7 +279,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getPath(from url : URL) throws -> String { + fileprivate func getPath(from url: URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath @@ -293,7 +293,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL @@ -304,7 +304,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } -open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuilder<T> { +open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -324,28 +324,28 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + case is Data.Type: - + completion(.success(Response(response: httpResponse, body: data as? T))) - + default: - + guard let data = data, !data.isEmpty else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse))) return } - + let decodeResult = CodableHelper.decode(T.self, from: data) - + switch decodeResult { case let .success(decodableObj): completion(.success(Response(response: httpResponse, body: decodableObj))) @@ -356,10 +356,10 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil } } -fileprivate class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { - +private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { + var credential: URLCredential? - + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { @@ -402,13 +402,13 @@ public protocol ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest } -fileprivate class URLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) throws -> URLRequest { - +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - + guard let parameters = parameters else { return urlRequest } - + guard let url = urlRequest.url else { throw DownloadException.requestMissingURL } @@ -417,12 +417,12 @@ fileprivate class URLEncoding: ParameterEncoding { urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) urlRequest.url = urlComponents.url } - + return urlRequest } } -fileprivate class FileUploadEncoding: ParameterEncoding { +private class FileUploadEncoding: ParameterEncoding { let contentTypeForFormPart: (_ fileURL: URL) -> String? @@ -433,13 +433,13 @@ fileprivate class FileUploadEncoding: ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { var urlRequest = urlRequest - + guard let parameters = parameters, !parameters.isEmpty else { return urlRequest } - + let boundary = "Boundary-\(UUID().uuidString)" - + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") for (key, value) in parameters { @@ -479,7 +479,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { fatalError("Unprocessable value \(value) with key \(key)") } } - + var body = urlRequest.httpBody.orEmpty body.append("\r\n--\(boundary)--\r\n") @@ -494,7 +494,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { var urlRequest = urlRequest var body = urlRequest.httpBody.orEmpty - + let fileData = try Data(contentsOf: fileURL) let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) @@ -502,7 +502,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } @@ -518,20 +518,20 @@ fileprivate class FileUploadEncoding: ParameterEncoding { // The value data. body.append(fileData) - + urlRequest.httpBody = body return urlRequest } - + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { var urlRequest = urlRequest - + var body = urlRequest.httpBody.orEmpty // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } diff --git a/samples/client/petstore/swift5/nonPublicApi/Package.swift b/samples/client/petstore/swift5/nonPublicApi/Package.swift index 79f6f81887383d4539292942c364aed2cfcfb5c6..96dfff54edf415c3c22de54b2758012c629b6f79 100644 --- a/samples/client/petstore/swift5/nonPublicApi/Package.swift +++ b/samples/client/petstore/swift5/nonPublicApi/Package.swift @@ -14,7 +14,7 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "PetstoreClient", - targets: ["PetstoreClient"]), + targets: ["PetstoreClient"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -26,6 +26,6 @@ let package = Package( name: "PetstoreClient", dependencies: [], path: "PetstoreClient/Classes" - ), + ) ] ) diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 799478f138f9ccc72e2f7dedaf2310b9852911e9..1a1716eb8a3ae6bfb268fe4d3244f6181289b780 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,7 +7,7 @@ import Foundation internal struct APIHelper { - internal static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { + internal static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,17 +20,17 @@ internal struct APIHelper { return destination } - internal static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + internal static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? Array<Any?> { - result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" } } } - internal static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + internal static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { guard let source = source else { return nil } @@ -46,15 +46,15 @@ internal struct APIHelper { } internal static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? Array<Any?> { + if let collection = source as? [Any?] { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - internal static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { + internal static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? Array<Any?> { + if let collection = item.value as? [Any?] { collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in result.append(URLQueryItem(name: item.key, value: value)) } @@ -69,4 +69,3 @@ internal struct APIHelper { return destination } } - diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift index 7fa1e45632ebbb4e745098002165dc5fe28d77b3..5dfbd9cea8d9761a2b630914223cb93971560d57 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,15 +9,15 @@ import Foundation internal class PetstoreClientAPI { internal static var basePath = "http://petstore.swagger.io:80/v2" internal static var credential: URLCredential? - internal static var customHeaders: [String:String] = [:] + internal static var customHeaders: [String: String] = [:] internal static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() internal static var apiResponseQueue: DispatchQueue = .main } internal class RequestBuilder<T> { var credential: URLCredential? - var headers: [String:String] - internal let parameters: [String:Any]? + var headers: [String: String] + internal let parameters: [String: Any]? internal let isBody: Bool internal let method: String internal let URLString: String @@ -25,9 +25,9 @@ internal class RequestBuilder<T> { /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. /// If you need to get the request's progress in older OS versions, please use Alamofire http client. - internal var onProgressReady: ((Progress) -> ())? + internal var onProgressReady: ((Progress) -> Void)? - required internal init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + required internal init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -37,7 +37,7 @@ internal class RequestBuilder<T> { addHeaders(PetstoreClientAPI.customHeaders) } - internal func addHeaders(_ aHeaders:[String:String]) { + internal func addHeaders(_ aHeaders: [String: String]) { for (header, value) in aHeaders { headers[header] = value } @@ -60,5 +60,5 @@ internal class RequestBuilder<T> { internal protocol RequestBuilderFactory { func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 81f23f107ad66a4b6c3c91a6dd62576262249ea6..174e6c12aeddfb35eec3e47b97abdc52b1e0e66a 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - internal class AnotherFakeAPI { /** To test special tags @@ -17,7 +15,7 @@ internal class AnotherFakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + internal class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index e52322c01c518dab212d92057769cc439bd1b00c..ab1b8f092475c6e189fbc704ebf7738a3c8653f8 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - internal class FakeAPI { /** @@ -16,7 +14,7 @@ internal class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?,_ error: Error?) -> Void)) { + internal class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) { fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -51,7 +49,7 @@ internal class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) { + internal class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) { fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -86,7 +84,7 @@ internal class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?,_ error: Error?) -> Void)) { + internal class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) { fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -121,7 +119,7 @@ internal class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + internal class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -156,7 +154,7 @@ internal class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -192,7 +190,7 @@ internal class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -231,7 +229,7 @@ internal class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + internal class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -281,7 +279,7 @@ internal class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func testEndpointParameters(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double, string: String? = nil, patternWithoutDelimiter: String, byte: Data, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func testEndpointParameters(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double, string: String? = nil, patternWithoutDelimiter: String, byte: Data, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(integer: integer, int32: int32, int64: int64, number: number, float: float, double: double, string: string, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -318,7 +316,7 @@ internal class FakeAPI { internal class func testEndpointParametersWithRequestBuilder(integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, number: Double, float: Float? = nil, double: Double, string: String? = nil, patternWithoutDelimiter: String, byte: Data, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), @@ -337,7 +335,7 @@ internal class FakeAPI { let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -426,7 +424,7 @@ internal class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -454,19 +452,19 @@ internal class FakeAPI { internal class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "enum_form_string_array": enumFormStringArray?.encodeToJSON(), "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), - "enum_query_string": enumQueryString?.encodeToJSON(), - "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -492,7 +490,7 @@ internal class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -518,13 +516,13 @@ internal class FakeAPI { internal class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": requiredStringGroup.encodeToJSON(), - "required_int64_group": requiredInt64Group.encodeToJSON(), - "string_group": stringGroup?.encodeToJSON(), + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -545,7 +543,7 @@ internal class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func testInlineAdditionalProperties(param: [String:String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -562,7 +560,7 @@ internal class FakeAPI { - parameter param: (body) request body - returns: RequestBuilder<Void> */ - internal class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> { + internal class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> { let path = "/fake/inline-additionalProperties" let URLString = PetstoreClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) @@ -582,7 +580,7 @@ internal class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -603,14 +601,14 @@ internal class FakeAPI { internal class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "param": param.encodeToJSON(), "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 969fc92e025d572de5f2874252f7d1918c1499fb..548c5fb352365644d37a80115d3a235d97a3721d 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -7,8 +7,6 @@ import Foundation - - internal class FakeClassnameTags123API { /** To test class name in snake case @@ -17,7 +15,7 @@ internal class FakeClassnameTags123API { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + internal class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index d4b32bb967e539960b21e7fc127f2e3d67eb7658..cb54fce0dcb111c7792d2fb16591bf0dfee235bc 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -7,8 +7,6 @@ import Foundation - - internal class PetAPI { /** Add a new pet to the store @@ -17,7 +15,7 @@ internal class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -57,7 +55,7 @@ internal class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func deletePet(apiKey: String? = nil, petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func deletePet(apiKey: String? = nil, petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deletePetWithRequestBuilder(apiKey: apiKey, petId: petId).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -84,8 +82,8 @@ internal class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ "api_key": apiKey?.encodeToJSON() @@ -113,7 +111,7 @@ internal class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + internal class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -137,8 +135,8 @@ internal class PetAPI { internal class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "status": status.encodeToJSON() @@ -157,7 +155,7 @@ internal class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @available(*, deprecated, message: "This operation is deprecated.") - internal class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + internal class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -182,8 +180,8 @@ internal class PetAPI { internal class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "tags": tags.encodeToJSON() @@ -201,7 +199,7 @@ internal class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?,_ error: Error?) -> Void)) { + internal class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) { getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,8 +226,8 @@ internal class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -244,7 +242,7 @@ internal class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -285,7 +283,7 @@ internal class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -313,14 +311,14 @@ internal class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "name": name?.encodeToJSON(), "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -337,7 +335,7 @@ internal class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + internal class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -365,14 +363,14 @@ internal class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -389,7 +387,7 @@ internal class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func uploadFileWithRequiredFile(petId: Int64, additionalMetadata: String? = nil, requiredFile: URL, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + internal class func uploadFileWithRequiredFile(petId: Int64, additionalMetadata: String? = nil, requiredFile: URL, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, requiredFile: requiredFile).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -417,14 +415,14 @@ internal class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 528a19a9032b9175592130e22362f46572c7bbf3..f1e423111d09f1aa19d85d818ef6b761019c4b3f 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -7,8 +7,6 @@ import Foundation - - internal class StoreAPI { /** Delete purchase order by ID @@ -17,7 +15,7 @@ internal class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -41,8 +39,8 @@ internal class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -56,7 +54,7 @@ internal class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String:Int]?,_ error: Error?) -> Void)) { + internal class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) { getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -76,14 +74,14 @@ internal class StoreAPI { - name: api_key - returns: RequestBuilder<[String:Int]> */ - internal class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { + internal class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { let path = "/store/inventory" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } @@ -95,7 +93,7 @@ internal class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + internal class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -119,8 +117,8 @@ internal class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -135,7 +133,7 @@ internal class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + internal class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 298a7fee485010c3066a6c62e9dfa99d097477a3..c8d714e89916b3a16b545e52bfde9ddcdede826d 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -7,8 +7,6 @@ import Foundation - - internal class UserAPI { /** Create user @@ -17,7 +15,7 @@ internal class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -54,7 +52,7 @@ internal class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -90,7 +88,7 @@ internal class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -126,7 +124,7 @@ internal class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -150,8 +148,8 @@ internal class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -166,7 +164,7 @@ internal class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?,_ error: Error?) -> Void)) { + internal class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) { getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -189,8 +187,8 @@ internal class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -206,7 +204,7 @@ internal class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + internal class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,11 +226,11 @@ internal class UserAPI { internal class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username.encodeToJSON(), + "username": username.encodeToJSON(), "password": password.encodeToJSON() ]) @@ -247,7 +245,7 @@ internal class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -266,8 +264,8 @@ internal class UserAPI { internal class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -283,7 +281,7 @@ internal class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - internal class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + internal class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 1fcfa109860d978fa6bd3896e82683a8f44054ac..280238b8263da4a309d981cb14250bddbc743f07 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -45,4 +45,4 @@ internal class CodableHelper { internal class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { return Swift.Result { try self.jsonEncoder.encode(value) } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Configuration.swift index 400d8bd126c7664a37a983686d9caef14ba5a641..4dfbe7b0cde726eae551c9a732f8b6cf6b83766d 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,10 +7,10 @@ import Foundation internal class Configuration { - + // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") internal static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} \ No newline at end of file + +} 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 f7550a684a7ae3ec0324e4dd11942f7741e3d271..e5511b3aa373ee70393b64d4d6fd40b11ecbd24a 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -108,24 +108,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - internal mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + internal mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - internal mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + internal mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { if let values = values { try encodeArray(values, forKey: key) } } - internal mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable { + internal mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - internal mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable { + internal mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - internal func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + internal func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - internal func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { - var tmpArray: [T]? = nil + internal func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? if contains(key) { tmpArray = try decodeArray(T.self, forKey: key) @@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - internal func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable { - var map: [Self.Key : T] = [:] + internal func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -177,5 +177,3 @@ extension HTTPURLResponse { return Array(200 ..< 300).contains(statusCode) } } - - diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift index 332e960ac68c6c25febfcbae5dab9b4dcdb24521..6b69f3b1bd50ce8b0d1e3e7363870a2e45e6433a 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -41,7 +41,7 @@ internal struct JSONDataEncoding { } internal static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? = nil + var returnedParams: [String: Any]? if let jsonData = jsonData, !jsonData.isEmpty { var params: [String: Any] = [:] params[jsonDataKey] = jsonData diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 47329d53ee41b4978c2dbbd2aca5643af3cc8f9c..7d8f433dfea7fc1364523f96f3160df36c5b723e 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -9,8 +9,8 @@ import Foundation internal class JSONEncodingHelper { - internal class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? = nil + internal class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? // Encode the Encodable object if let encodableObj = encodableObj { @@ -27,7 +27,7 @@ internal class JSONEncodingHelper { } internal class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? = nil + var params: [String: Any]? if let encodableObj = encodableObj { do { @@ -41,5 +41,5 @@ internal class JSONEncodingHelper { return params } - + } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift index 236120acc15eb1af95dafe5da0a1ec331e766348..6089ac67d0d8de6d81d0d8af42151850c96ff6b5 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,11 +10,11 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -internal enum ErrorResponse : Error { +internal enum ErrorResponse: Error { case error(Int, Data?, Error) } -internal enum DownloadException : Error { +internal enum DownloadException: Error { case responseDataMissing case responseFailed case requestMissing @@ -30,7 +30,6 @@ internal enum DecodableRequestBuilderError: Error { case generalError(Error) } - internal class Response<T> { internal let statusCode: Int internal let header: [String: String] @@ -44,7 +43,7 @@ internal class Response<T> { internal convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String:String]() + var header = [String: String]() for (key, value) in rawHeader { if let key = key.base as? String, let value = value as? String { header[key] = value diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index c8876320f47a33f56aabdc8dc979956ac4532f45..b4d5ae6faf93db0901f961ee5ff7399d9664e8d6 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,19 +7,17 @@ import Foundation +internal struct AdditionalPropertiesClass: Codable { -internal struct AdditionalPropertiesClass: Codable { + internal var mapString: [String: String]? + internal var mapMapString: [String: [String: String]]? - - internal var mapString: [String:String]? - internal var mapMapString: [String:[String:String]]? - - internal init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { + internal init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { self.mapString = mapString self.mapMapString = mapMapString } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case mapString = "map_string" case mapMapString = "map_map_string" } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index 20d157f4ebcb13d1dc441407f65d64cf58f9a77b..ada7f86de5098c58e5e4ffbd740c56f2163d3f3a 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct Animal: Codable { - +internal struct Animal: Codable { internal var className: String internal var color: String? = "red" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift index 9c570350859f0cff11625a16a1e8066a492330a8..3ebe9e9a5deafeace42ef160df047a98dcde24b6 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -7,5 +7,4 @@ import Foundation - internal typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index 88b4b69c16687248d32305e39bafd22d849d8f75..b60d8999b4b20cad0dcf27e02f9cd2d184d68697 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct ApiResponse: Codable { - +internal struct ApiResponse: Codable { internal var code: Int? internal var type: String? diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 3e8bc3da83b114c9a3cefd5f961f2421bc3bad63..67371b816b30aa7ca4e76b839c40f9e155892f4a 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct ArrayOfArrayOfNumberOnly: Codable { - +internal struct ArrayOfArrayOfNumberOnly: Codable { internal var arrayArrayNumber: [[Double]]? @@ -17,7 +15,7 @@ internal struct ArrayOfArrayOfNumberOnly: Codable { self.arrayArrayNumber = arrayArrayNumber } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case arrayArrayNumber = "ArrayArrayNumber" } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index 8e92c78e4da3d31fbb9ae9ea2b1de9a6f056a711..2c7047eac4b04401e15253d768ba93a9c73a3eeb 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct ArrayOfNumberOnly: Codable { - +internal struct ArrayOfNumberOnly: Codable { internal var arrayNumber: [Double]? @@ -17,7 +15,7 @@ internal struct ArrayOfNumberOnly: Codable { self.arrayNumber = arrayNumber } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case arrayNumber = "ArrayNumber" } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index d7916cf20b9c76cc6406663ca13289689e64c028..9c3a3a9f5e1fcf4a0a172abf23c519ca87d9cc36 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct ArrayTest: Codable { - +internal struct ArrayTest: Codable { internal var arrayOfString: [String]? internal var arrayArrayOfInteger: [[Int64]]? @@ -21,7 +19,7 @@ internal struct ArrayTest: Codable { self.arrayArrayOfModel = arrayArrayOfModel } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case arrayOfString = "array_of_string" case arrayArrayOfInteger = "array_array_of_integer" case arrayArrayOfModel = "array_array_of_model" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index 17221a54edb609965a18435d280c51ff5f5689a8..965ec5aefba33f0f10de95ca9b90cc744edee2a0 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct Capitalization: Codable { - +internal struct Capitalization: Codable { internal var smallCamel: String? internal var capitalCamel: String? @@ -28,7 +26,7 @@ internal struct Capitalization: Codable { self.ATT_NAME = ATT_NAME } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case smallCamel case capitalCamel = "CapitalCamel" case smallSnake = "small_Snake" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index 28292469ddae9433446b54e22daaab39e55ab750..8a603dee5f1f6087ed630ba7f8e35d41c2f5341a 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct Cat: Codable { - +internal struct Cat: Codable { internal var className: String internal var color: String? = "red" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift index cdcb1aa14b5761202a36010083ead5a4f1c3ee7d..45b7dbb26dcf595e1f901220e4da531f097eb24f 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct CatAllOf: Codable { - +internal struct CatAllOf: Codable { internal var declawed: Bool? diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 9b061937e091b9547464fec0904cc0e76b15652b..849bf788dfb37acdd151a5aafb3a78e7bd16b198 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct Category: Codable { - +internal struct Category: Codable { internal var id: Int64? internal var name: String = "default-name" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index 034cbadc8dd62a6718d1414ee8bf2ccda8698ab0..0f1bc19fe59576fd7b70625d58e0c009a62bd0dc 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -internal struct ClassModel: Codable { - +internal struct ClassModel: Codable { internal var _class: String? diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index e33907ca3a3c5050ccfb200e4425cc26f4655135..ddee836043fa62d40a27235af26a0db25596eab3 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct Client: Codable { - +internal struct Client: Codable { internal var client: String? diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 3d45b8ac7a13b0bc4fd0b182497e94f37fdfbf2e..6b5250de4a4ae503787cc284e3d69b04c9ec3a45 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct Dog: Codable { - +internal struct Dog: Codable { internal var className: String internal var color: String? = "red" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift index 6fb9a0505161bd599c94f8b66893368f97cc0a66..ef3ff7f1d78b728b4e366795644523cf2fee18c0 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct DogAllOf: Codable { - +internal struct DogAllOf: Codable { internal var breed: String? diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index 8aa9c2bd58d23d06e19131dea477b38f83a96d4d..bb9f64cfb43880f60e62744597817bf7425fc06f 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct EnumArrays: Codable { - +internal struct EnumArrays: Codable { internal enum JustSymbol: String, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -27,7 +25,7 @@ internal struct EnumArrays: Codable { self.arrayEnum = arrayEnum } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case justSymbol = "just_symbol" case arrayEnum = "array_enum" } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift index 07dfc16a69f2ef812f278afcef35457d02aef879..71fd29e0d2a53e9b22f6d21c00eacfded42267c0 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -7,7 +7,6 @@ import Foundation - internal enum EnumClass: String, Codable, CaseIterable { case abc = "_abc" case efg = "-efg" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index 4081beae4c0a77e1c9f74636726483d2522eb138..421aa5436b04160af2d2aa0214e5e669d64d3e5a 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct EnumTest: Codable { - +internal struct EnumTest: Codable { internal enum EnumString: String, Codable, CaseIterable { case upper = "UPPER" @@ -43,7 +41,7 @@ internal struct EnumTest: Codable { self.outerEnum = outerEnum } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case enumString = "enum_string" case enumStringRequired = "enum_string_required" case enumInteger = "enum_integer" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/File.swift index 166138041ecf5cb69539ff05b49c6382533c277f..632402fb9e03874922a30100e5221624b0adfc10 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,8 +8,7 @@ import Foundation /** Must be named `File` for test. */ -internal struct File: Codable { - +internal struct File: Codable { /** Test capitalization */ internal var sourceURI: String? diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 2245e94bcc90725e2e472f5ad0c96aca71d322fb..e478e6c4b7d17c6e38bde7142d46a5e2235c5c95 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct FileSchemaTestClass: Codable { - +internal struct FileSchemaTestClass: Codable { internal var file: File? internal var files: [File]? diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 30b11efb2e1946fcb1a68064bcd3cb307a2c25ba..23395c93b569d6f18d81d830dd1630ee3e1e1120 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct FormatTest: Codable { - +internal struct FormatTest: Codable { internal var integer: Int? internal var int32: Int? diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index d51b4421dfe6592cfc884dd701f395fb9d9c0ee6..831963ba2ed231ca231dddf9b9e2c503b3be5803 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct HasOnlyReadOnly: Codable { - +internal struct HasOnlyReadOnly: Codable { internal var bar: String? internal var foo: String? diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 0a76cba0ed92a43880238a5c3eca0ff4d954ee5a..c5960de215135ae03c7ecf59102253794d540fac 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct List: Codable { - +internal struct List: Codable { internal var _123list: String? @@ -17,7 +15,7 @@ internal struct List: Codable { self._123list = _123list } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case _123list = "123-list" } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index b0a860092bc6ebfb3ef3542faac0bb2f31d9234c..db4f8f436aa507c614c1724bf3e45a06274f62a6 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,27 +7,25 @@ import Foundation - -internal struct MapTest: Codable { - +internal struct MapTest: Codable { internal enum MapOfEnumString: String, Codable, CaseIterable { case upper = "UPPER" case lower = "lower" } - internal var mapMapOfString: [String:[String:String]]? - internal var mapOfEnumString: [String:String]? - internal var directMap: [String:Bool]? + internal var mapMapOfString: [String: [String: String]]? + internal var mapOfEnumString: [String: String]? + internal var directMap: [String: Bool]? internal var indirectMap: StringBooleanMap? - internal init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) { + internal init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { self.mapMapOfString = mapMapOfString self.mapOfEnumString = mapOfEnumString self.directMap = directMap self.indirectMap = indirectMap } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case mapMapOfString = "map_map_of_string" case mapOfEnumString = "map_of_enum_string" case directMap = "direct_map" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index c6fa4baaecd7fcf004a158f9c653576420c06fd0..c71bb9256b0ab039eef886f55f9ff6e798703a13 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,15 +7,13 @@ import Foundation - -internal struct MixedPropertiesAndAdditionalPropertiesClass: Codable { - +internal struct MixedPropertiesAndAdditionalPropertiesClass: Codable { internal var uuid: UUID? internal var dateTime: Date? - internal var map: [String:Animal]? + internal var map: [String: Animal]? - internal init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) { + internal init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { self.uuid = uuid self.dateTime = dateTime self.map = map diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index 2a81b0ac927322ac2c33de9b05c80654a0931e36..5d31a885f7518fc6c9173b2165787afa1bbf91a4 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -internal struct Model200Response: Codable { - +internal struct Model200Response: Codable { internal var name: Int? internal var _class: String? @@ -19,7 +18,7 @@ internal struct Model200Response: Codable { self._class = _class } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case name case _class = "class" } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index 5c7df21487687732c6a578f2663c05fb3ac65319..2aa8fb1524c3dc6f5eff7f7fa423c2eff552c94f 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -internal struct Name: Codable { - +internal struct Name: Codable { internal var name: Int internal var snakeCase: Int? @@ -23,7 +22,7 @@ internal struct Name: Codable { self._123number = _123number } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case name case snakeCase = "snake_case" case property diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 3473e70164472fb25a96365c0570b32e64cf6170..49d73706e398664ce361c9ab7a367d20baff3ffc 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct NumberOnly: Codable { - +internal struct NumberOnly: Codable { internal var justNumber: Double? @@ -17,7 +15,7 @@ internal struct NumberOnly: Codable { self.justNumber = justNumber } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case justNumber = "JustNumber" } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index b6fd07e148b5a41a77962734fdf5271872844548..dcefb40efa2baa33d2eb071ea078ce81b41875e7 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct Order: Codable { - +internal struct Order: Codable { internal enum Status: String, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 592f9a849ce3eff2b9efa53e473871ca2bee1c6d..c61c2c4a4620707abe78e22a285b8cfc536b4e92 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct OuterComposite: Codable { - +internal struct OuterComposite: Codable { internal var myNumber: Double? internal var myString: String? @@ -21,7 +19,7 @@ internal struct OuterComposite: Codable { self.myBoolean = myBoolean } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case myNumber = "my_number" case myString = "my_string" case myBoolean = "my_boolean" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift index ab1397d4f31da8b3896f12bf3166b9d4fe7307e7..e0cdcbea055810c60923f315237873218971c330 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -7,7 +7,6 @@ import Foundation - internal enum OuterEnum: String, Codable, CaseIterable { case placed = "placed" case approved = "approved" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 0cf0f0d3b4b564230096eba29aab38cd808f591a..b71700544d060fb56c91a73d512f5cc9c36b6109 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct Pet: Codable { - +internal struct Pet: Codable { internal enum Status: String, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index 8792cf4aa754fbc6e78fb7a9887cbc298036bcb5..d02c6cc5fd9fc219520a2755bd512f97dea18168 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct ReadOnlyFirst: Codable { - +internal struct ReadOnlyFirst: Codable { internal var bar: String? internal var baz: String? diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index 82b73db4b37ed26034e108ee4b4f2fd90a1a34de..95a18b571aded1adcf200c0d77f38c79ad5fb120 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing reserved words */ -internal struct Return: Codable { - +internal struct Return: Codable { internal var _return: Int? @@ -17,7 +16,7 @@ internal struct Return: Codable { self._return = _return } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case _return = "return" } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index e98a8fd7955c1016ed8ee8906be9e8c50a226d8e..b6ac3651f0e7f279258007d6b45ca5b3569cb078 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct SpecialModelName: Codable { - +internal struct SpecialModelName: Codable { internal var specialPropertyName: Int64? @@ -17,7 +15,7 @@ internal struct SpecialModelName: Codable { self.specialPropertyName = specialPropertyName } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case specialPropertyName = "$special[property.name]" } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index d1afe6732a46ea19c3a1f87c2badc1f288d1b97c..dc3d00e13014c0fa3be35257e6c43950ad26c05c 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,12 +7,9 @@ import Foundation +internal struct StringBooleanMap: Codable { -internal struct StringBooleanMap: Codable { - - - - internal var additionalProperties: [String:Bool] = [:] + internal var additionalProperties: [String: Bool] = [:] internal subscript(key: String) -> Bool? { get { @@ -45,5 +42,4 @@ internal struct StringBooleanMap: Codable { additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - } diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 923acc9b1f69212ed1e7301f70fa52974664d55e..1e4de951fb2c22ae78c05b1e27303e50d2d0da37 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct Tag: Codable { - +internal struct Tag: Codable { internal var id: Int64? internal var name: String? diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index e78ae839f50326432f91a1adbadb64d0a710369f..83908bb4fc941dbe9f4748d811164c1284c06010 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct TypeHolderDefault: Codable { - +internal struct TypeHolderDefault: Codable { internal var stringItem: String = "what" internal var numberItem: Double @@ -25,7 +23,7 @@ internal struct TypeHolderDefault: Codable { self.arrayItem = arrayItem } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index c829014f0d444ca47f109fa149624f16f786fc70..3e2c6193aa3e245bb4a73df51dad2e0799ce57ba 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct TypeHolderExample: Codable { - +internal struct TypeHolderExample: Codable { internal var stringItem: String internal var numberItem: Double @@ -25,7 +23,7 @@ internal struct TypeHolderExample: Codable { self.arrayItem = arrayItem } - internal enum CodingKeys: String, CodingKey, CaseIterable { + internal enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/User.swift index c2865a57922074a0bae3a5ed0e9132cbc93a8062..ada8a7f82d961fcff03bf771d217227ef0428a75 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,9 +7,7 @@ import Foundation - -internal struct User: Codable { - +internal struct User: Codable { internal var id: Int64? internal var username: String? 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 bf6cc62224b2eeebceac75048ab6714f430c7930..a907ec1d345e85d0d2bd5fed0e449a873ae09bcb 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -14,7 +14,7 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { return URLSessionRequestBuilder<T>.self } - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type { + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { return URLSessionDecodableRequestBuilder<T>.self } } @@ -23,16 +23,16 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { private var urlSessionStore = SynchronizedDictionary<String, URLSession>() internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { - + private var observation: NSKeyValueObservation? - + deinit { observation?.invalidate() } - + // swiftlint:disable:next weak_delegate fileprivate let sessionDelegate = SessionDelegate() - + /** May be assigned if you want to control the authentication challenges. */ @@ -45,11 +45,11 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { - retry the request. */ internal var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? - - required internal init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { + + required internal init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } - + /** May be overridden by a subclass if you want to control the URLSession configuration. @@ -77,40 +77,40 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { May be overridden by a subclass if you want to control the URLRequest configuration (e.g. to override the cache policy). */ - internal func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) throws -> URLRequest { - + internal func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { + guard let url = URL(string: URLString) else { throw DownloadException.requestMissingURL } - + var originalRequest = URLRequest(url: url) - + originalRequest.httpMethod = method.rawValue - + buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + headers.forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) - + return modifiedRequest } override internal func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { - let urlSessionId:String = UUID().uuidString + let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() urlSessionStore[urlSessionId] = urlSession - + let parameters: [String: Any] = self.parameters ?? [:] - + let fileKeys = parameters.filter { $1 is URL } .map { $0.0 } - + let encoding: ParameterEncoding if fileKeys.count > 0 { encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) @@ -119,29 +119,29 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { } else { encoding = URLEncoding() } - + guard let xMethod = HTTPMethod(rawValue: method) else { fatalError("Unsuported Http method - \(method)") } - + let cleanupRequest = { urlSessionStore[urlSessionId] = nil self.observation?.invalidate() } - + do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - + let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - + guard let self = self else { return } - + if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - + taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - + guard let self = self else { return } - + if shouldRetry { cleanupRequest() self.execute(apiResponseQueue, completion) @@ -157,13 +157,13 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } } - + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { onProgressReady?(dataTask.progress) } - + dataTask.resume() - + } catch { apiResponseQueue.async { cleanupRequest() @@ -172,7 +172,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } - + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -192,52 +192,52 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is URL.Type: do { - + guard error == nil else { throw DownloadException.responseFailed } - + guard let data = data else { throw DownloadException.responseDataMissing } - + let fileManager = FileManager.default let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] let requestURL = try self.getURL(from: urlRequest) - + var requestPath = try self.getPath(from: requestURL) - + if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { requestPath = requestPath.appending("/\(headerFileName)") } - + let filePath = documentsDirectory.appendingPathComponent(requestPath) let directoryPath = filePath.deletingLastPathComponent().path - + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) - + completion(.success(Response(response: httpResponse, body: filePath as? T))) - + } catch let requestParserError as DownloadException { completion(.failure(ErrorResponse.error(400, data, requestParserError))) } catch let error { completion(.failure(ErrorResponse.error(400, data, error))) } - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + default: - + completion(.success(Response(response: httpResponse, body: data as? T))) } @@ -251,7 +251,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { guard let contentDisposition = contentDisposition else { return nil @@ -270,7 +270,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { filename = contentItem return filename? - .replacingCharacters(in: range, with:"") + .replacingCharacters(in: range, with: "") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } @@ -279,7 +279,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getPath(from url : URL) throws -> String { + fileprivate func getPath(from url: URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath @@ -293,7 +293,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL @@ -304,7 +304,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { } -internal class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuilder<T> { +internal class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -324,28 +324,28 @@ internal class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequest switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + case is Data.Type: - + completion(.success(Response(response: httpResponse, body: data as? T))) - + default: - + guard let data = data, !data.isEmpty else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse))) return } - + let decodeResult = CodableHelper.decode(T.self, from: data) - + switch decodeResult { case let .success(decodableObj): completion(.success(Response(response: httpResponse, body: decodableObj))) @@ -356,10 +356,10 @@ internal class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequest } } -fileprivate class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { - +private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { + var credential: URLCredential? - + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { @@ -402,13 +402,13 @@ internal protocol ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest } -fileprivate class URLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) throws -> URLRequest { - +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - + guard let parameters = parameters else { return urlRequest } - + guard let url = urlRequest.url else { throw DownloadException.requestMissingURL } @@ -417,12 +417,12 @@ fileprivate class URLEncoding: ParameterEncoding { urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) urlRequest.url = urlComponents.url } - + return urlRequest } } -fileprivate class FileUploadEncoding: ParameterEncoding { +private class FileUploadEncoding: ParameterEncoding { let contentTypeForFormPart: (_ fileURL: URL) -> String? @@ -433,13 +433,13 @@ fileprivate class FileUploadEncoding: ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { var urlRequest = urlRequest - + guard let parameters = parameters, !parameters.isEmpty else { return urlRequest } - + let boundary = "Boundary-\(UUID().uuidString)" - + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") for (key, value) in parameters { @@ -479,7 +479,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { fatalError("Unprocessable value \(value) with key \(key)") } } - + var body = urlRequest.httpBody.orEmpty body.append("\r\n--\(boundary)--\r\n") @@ -494,7 +494,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { var urlRequest = urlRequest var body = urlRequest.httpBody.orEmpty - + let fileData = try Data(contentsOf: fileURL) let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) @@ -502,7 +502,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } @@ -518,20 +518,20 @@ fileprivate class FileUploadEncoding: ParameterEncoding { // The value data. body.append(fileData) - + urlRequest.httpBody = body return urlRequest } - + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { var urlRequest = urlRequest - + var body = urlRequest.httpBody.orEmpty // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } diff --git a/samples/client/petstore/swift5/objcCompatible/Package.swift b/samples/client/petstore/swift5/objcCompatible/Package.swift index 79f6f81887383d4539292942c364aed2cfcfb5c6..96dfff54edf415c3c22de54b2758012c629b6f79 100644 --- a/samples/client/petstore/swift5/objcCompatible/Package.swift +++ b/samples/client/petstore/swift5/objcCompatible/Package.swift @@ -14,7 +14,7 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "PetstoreClient", - targets: ["PetstoreClient"]), + targets: ["PetstoreClient"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -26,6 +26,6 @@ let package = Package( name: "PetstoreClient", dependencies: [], path: "PetstoreClient/Classes" - ), + ) ] ) diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 2404bc8ffc6d6a190b82327193d4b5b2325dd515..5b09f9557113d4bc4d0ca8b0b05b4f408008c2ff 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,7 +7,7 @@ import Foundation public struct APIHelper { - public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,17 +20,17 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? Array<Any?> { - result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" } } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { guard let source = source else { return nil } @@ -46,15 +46,15 @@ public struct APIHelper { } public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? Array<Any?> { + if let collection = source as? [Any?] { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? Array<Any?> { + if let collection = item.value as? [Any?] { collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in result.append(URLQueryItem(name: item.key, value: value)) } @@ -69,4 +69,3 @@ public struct APIHelper { return destination } } - diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift index c5d1b9b42df33641cc1c81227a5027da0da95336..a5c2d605dff6f91df4130c2ff02d09919bae6974 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,15 +9,15 @@ import Foundation open class PetstoreClientAPI { public static var basePath = "http://petstore.swagger.io:80/v2" public static var credential: URLCredential? - public static var customHeaders: [String:String] = [:] + public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder<T> { var credential: URLCredential? - var headers: [String:String] - public let parameters: [String:Any]? + var headers: [String: String] + public let parameters: [String: Any]? public let isBody: Bool public let method: String public let URLString: String @@ -25,9 +25,9 @@ open class RequestBuilder<T> { /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. /// If you need to get the request's progress in older OS versions, please use Alamofire http client. - public var onProgressReady: ((Progress) -> ())? + public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -37,7 +37,7 @@ open class RequestBuilder<T> { addHeaders(PetstoreClientAPI.customHeaders) } - open func addHeaders(_ aHeaders:[String:String]) { + open func addHeaders(_ aHeaders: [String: String]) { for (header, value) in aHeaders { headers[header] = value } @@ -60,5 +60,5 @@ open class RequestBuilder<T> { public protocol RequestBuilderFactory { func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 41731036ab606b0f2af9e22741c93826aeacaa62..2e9ad96a66b587fe018e26dd5497f7962b03148e 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc open class AnotherFakeAPI : NSObject { +@objc open class AnotherFakeAPI: NSObject { /** To test special tags @@ -17,7 +15,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index fc51b002227721c6c205c23cc44406f45570a40c..6483ab29bcc348fc62fd39a86094a05d506b2a8d 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -7,16 +7,14 @@ import Foundation - - -@objc open class FakeAPI : NSObject { +@objc open class FakeAPI: NSObject { /** - parameter body: (body) Input boolean as post body (optional) - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?,_ error: Error?) -> Void)) { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) { fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -51,7 +49,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) { fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -86,7 +84,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?,_ error: Error?) -> Void)) { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) { fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -121,7 +119,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -156,7 +154,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -192,7 +190,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -231,7 +229,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -281,7 +279,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -318,7 +316,7 @@ import Foundation open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), @@ -337,7 +335,7 @@ import Foundation let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -426,7 +424,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -454,19 +452,19 @@ import Foundation open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "enum_form_string_array": enumFormStringArray?.encodeToJSON(), "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), - "enum_query_string": enumQueryString?.encodeToJSON(), - "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -492,7 +490,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -518,13 +516,13 @@ import Foundation open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": requiredStringGroup.encodeToJSON(), - "required_int64_group": requiredInt64Group.encodeToJSON(), - "string_group": stringGroup?.encodeToJSON(), + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -545,7 +543,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testInlineAdditionalProperties(param: [String:String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -562,7 +560,7 @@ import Foundation - parameter param: (body) request body - returns: RequestBuilder<Void> */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> { let path = "/fake/inline-additionalProperties" let URLString = PetstoreClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) @@ -582,7 +580,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -603,14 +601,14 @@ import Foundation open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "param": param.encodeToJSON(), "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 3793f6dc4128d4f3b806202b47ce899af9b4313b..b9cfc75eeb4c2f0b5ddac6edcae16571f51796a4 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc open class FakeClassnameTags123API : NSObject { +@objc open class FakeClassnameTags123API: NSObject { /** To test class name in snake case @@ -17,7 +15,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 86c6dcc9778f15bb37045f3f36df75b2fd67c2b6..d022b687736e7d90b052f25ea10de58cfffe022e 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc open class PetAPI : NSObject { +@objc open class PetAPI: NSObject { /** Add a new pet to the store @@ -17,7 +15,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -57,7 +55,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -84,8 +82,8 @@ import Foundation let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ "api_key": apiKey?.encodeToJSON() @@ -113,7 +111,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -137,8 +135,8 @@ import Foundation open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "status": status.encodeToJSON() @@ -157,7 +155,7 @@ import Foundation - parameter completion: completion handler to receive the data and the error objects */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -182,8 +180,8 @@ import Foundation open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "tags": tags.encodeToJSON() @@ -201,7 +199,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?,_ error: Error?) -> Void)) { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) { getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,8 +226,8 @@ import Foundation let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -244,7 +242,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -285,7 +283,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -313,14 +311,14 @@ import Foundation let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "name": name?.encodeToJSON(), "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -337,7 +335,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -365,14 +363,14 @@ import Foundation let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -389,7 +387,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -417,14 +415,14 @@ import Foundation let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index cc15cd3ae88ccb5ac711e148c08bf580fad3419e..a19d12c7d24b91bbd0b1019d6774b3867920bac9 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc open class StoreAPI : NSObject { +@objc open class StoreAPI: NSObject { /** Delete purchase order by ID @@ -17,7 +15,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -41,8 +39,8 @@ import Foundation let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -56,7 +54,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String:Int]?,_ error: Error?) -> Void)) { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) { getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -76,14 +74,14 @@ import Foundation - name: api_key - returns: RequestBuilder<[String:Int]> */ - open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { let path = "/store/inventory" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } @@ -95,7 +93,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -119,8 +117,8 @@ import Foundation let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -135,7 +133,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 6e0e10bc7b221dd97d2e7d06bc97d05bd33a4936..4dfe4da1a02199b0a5fa19dce71ce4dc530c6d1d 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc open class UserAPI : NSObject { +@objc open class UserAPI: NSObject { /** Create user @@ -17,7 +15,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -54,7 +52,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -90,7 +88,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -126,7 +124,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -150,8 +148,8 @@ import Foundation let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -166,7 +164,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?,_ error: Error?) -> Void)) { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) { getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -189,8 +187,8 @@ import Foundation let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -206,7 +204,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,11 +226,11 @@ import Foundation open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username.encodeToJSON(), + "username": username.encodeToJSON(), "password": password.encodeToJSON() ]) @@ -247,7 +245,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -266,8 +264,8 @@ import Foundation open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -283,7 +281,7 @@ import Foundation - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 01b28a4bd42d21245b26f53ba2766a44c3ff0d38..ef971ebadc60ae1d358d9d87e8727aa13ec7437b 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -45,4 +45,4 @@ open class CodableHelper { open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { return Swift.Result { try self.jsonEncoder.encode(value) } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Configuration.swift index f171525e43944f9cedf0e5146a39752fc2e848dc..627d9adb757ef30f3bf44723748aee6b5f1913d9 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,10 +7,10 @@ import Foundation open class Configuration { - + // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} \ No newline at end of file + +} 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 6e279679c67a1e7e3f302fc0fcbfd5b58a6dd12f..93ed6b90b376a7b84e9eabb1705f3dcb8bd98a14 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -108,24 +108,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { if let values = values { try encodeArray(values, forKey: key) } } - public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable { + public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable { + public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { - var tmpArray: [T]? = nil + public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? if contains(key) { tmpArray = try decodeArray(T.self, forKey: key) @@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable { - var map: [Self.Key : T] = [:] + public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -177,5 +177,3 @@ extension HTTPURLResponse { return Array(200 ..< 300).contains(statusCode) } } - - diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift index 08f1ef334dff10656c28e298c6b9b6d754159d73..b79e9f5e64d518e51552c62467884931ee1eaf3c 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -41,7 +41,7 @@ public struct JSONDataEncoding { } public static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? = nil + var returnedParams: [String: Any]? if let jsonData = jsonData, !jsonData.isEmpty { var params: [String: Any] = [:] params[jsonDataKey] = jsonData diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 314f1eff1f9b07d17db1930bfbe566baedbbc5cc..02f78ffb47056ddebac110679c4b545ed2861125 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -9,8 +9,8 @@ import Foundation open class JSONEncodingHelper { - open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? = nil + open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? // Encode the Encodable object if let encodableObj = encodableObj { @@ -27,7 +27,7 @@ open class JSONEncodingHelper { } open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? = nil + var params: [String: Any]? if let encodableObj = encodableObj { do { @@ -41,5 +41,5 @@ open class JSONEncodingHelper { return params } - + } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models.swift index 11e81ffcc472bbe9ca94aecdf5b731470979d0de..c0542c14c0812d73834b48ba2123704b096bd61c 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,11 +10,11 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse : Error { +public enum ErrorResponse: Error { case error(Int, Data?, Error) } -public enum DownloadException : Error { +public enum DownloadException: Error { case responseDataMissing case responseFailed case requestMissing @@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error { case generalError(Error) } - open class Response<T> { public let statusCode: Int public let header: [String: String] @@ -44,7 +43,7 @@ open class Response<T> { public convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String:String]() + var header = [String: String]() for (key, value) in rawHeader { if let key = key.base as? String, let value = value as? String { header[key] = value diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index d4e1b3697e71f68df0f8bb7ad77a3173268c01ce..e184d7691799445c4d719fc08f2abf8445cb3987 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,19 +7,17 @@ import Foundation +@objc public class AdditionalPropertiesClass: NSObject, Codable { + public var mapString: [String: String]? + public var mapMapString: [String: [String: String]]? -@objc public class AdditionalPropertiesClass: NSObject, Codable { - - public var mapString: [String:String]? - public var mapMapString: [String:[String:String]]? - - public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { + public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { self.mapString = mapString self.mapMapString = mapMapString } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapString = "map_string" case mapMapString = "map_map_string" } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index f34ba3bb63e7bf1b8f00581c6c740ab27e4e12f8..88152934da2b6d2c736edd8b897fc430c183ac20 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class Animal: NSObject, Codable { +@objc public class Animal: NSObject, Codable { public var _className: String public var color: String? = "red" @@ -19,7 +17,7 @@ import Foundation self.color = color } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _className = "className" case color } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift index e7bea63f8ed28132865ea4d3c23eab55666cf4f6..e09b0e9efdc8ca7798114f24aff21f57e8f9fabd 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -7,5 +7,4 @@ import Foundation - public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index d9a7fae2144608816991f68cbbade8d39f2a03ac..d0fcd4368854a294de676ad885a35b034696c74a 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class ApiResponse: NSObject, Codable { +@objc public class ApiResponse: NSObject, Codable { public var code: Int? public var codeNum: NSNumber? { diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index e57e63b6ed285551ee5b689dd1018d498d0f7e5a..9e3f3aba246ac6743276619c54870af9478452bd 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class ArrayOfArrayOfNumberOnly: NSObject, Codable { +@objc public class ArrayOfArrayOfNumberOnly: NSObject, Codable { public var arrayArrayNumber: [[Double]]? @@ -17,7 +15,7 @@ import Foundation self.arrayArrayNumber = arrayArrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayArrayNumber = "ArrayArrayNumber" } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index e087329fdc4474bff3779e9f93f5d7e36ea8d9cd..d287cc1563aa11e7e9e46e16fb1fb1212a985b94 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class ArrayOfNumberOnly: NSObject, Codable { +@objc public class ArrayOfNumberOnly: NSObject, Codable { public var arrayNumber: [Double]? @@ -17,7 +15,7 @@ import Foundation self.arrayNumber = arrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayNumber = "ArrayNumber" } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index c7e6b0b27a4b4e0dde1d9a2e7d3db8ac59b4ba91..dcc3e9c3dd51c395b9d1499489e7b9181da71cb0 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class ArrayTest: NSObject, Codable { +@objc public class ArrayTest: NSObject, Codable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? @@ -21,7 +19,7 @@ import Foundation self.arrayArrayOfModel = arrayArrayOfModel } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayOfString = "array_of_string" case arrayArrayOfInteger = "array_array_of_integer" case arrayArrayOfModel = "array_array_of_model" diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index e472eaaa7916f19a96da8841e08e222b087fae08..80a5667445f2bba18d8a0908dacef6b59e5e5c9f 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class Capitalization: NSObject, Codable { +@objc public class Capitalization: NSObject, Codable { public var smallCamel: String? public var capitalCamel: String? @@ -28,7 +26,7 @@ import Foundation self.ATT_NAME = ATT_NAME } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case smallCamel case capitalCamel = "CapitalCamel" case smallSnake = "small_Snake" diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index 1b19800ae3c368dde22743fbe74cb9ad2539e192..78de5a909f540d94ceac7c9c471ebb25fab2a58f 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class Cat: NSObject, Codable { +@objc public class Cat: NSObject, Codable { public var _className: String public var color: String? = "red" @@ -26,7 +24,7 @@ import Foundation self.declawed = declawed } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _className = "className" case color case declawed diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift index 8758762c40bfb21d165390e2e46cb20ebbd2a822..ef8cec45aff1109393cdf5acf1cd700fb2d8ae1d 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class CatAllOf: NSObject, Codable { +@objc public class CatAllOf: NSObject, Codable { public var declawed: Bool? public var declawedNum: NSNumber? { diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index df7771efc457bdb2e2ff667e78c68d9dd3726ea6..0610c10c982f46646ee59426c0229decacd0b4d8 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class Category: NSObject, Codable { +@objc public class Category: NSObject, Codable { public var _id: Int64? public var _idNum: NSNumber? { @@ -24,7 +22,7 @@ import Foundation self.name = name } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _id = "id" case name } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index c221ccf2a0de78aa455bf2614d48e722392996f5..4197ffcaed6c86e6b57853cf7fdd6d6297c9bd08 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -9,7 +9,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -@objc public class ClassModel: NSObject, Codable { +@objc public class ClassModel: NSObject, Codable { public var _class: String? diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index 5aea86fbb06e5b82b0f5a74d65eacff30812ce0b..517dbbba2ec25fb9177c2228e992f9b330106514 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class Client: NSObject, Codable { +@objc public class Client: NSObject, Codable { public var client: String? diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 464f0c7ae4e75d9bf4937a55eee622de50a27a11..37733cd1f3be381517ccbbc5c44ef842f0e59ef5 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class Dog: NSObject, Codable { +@objc public class Dog: NSObject, Codable { public var _className: String public var color: String? = "red" @@ -21,7 +19,7 @@ import Foundation self.breed = breed } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _className = "className" case color case breed diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift index efcd880f10b3bcebf3b15c5910120ed6b9a9971b..73fd1822725c95dcd4226057a1c84ff869c56a3f 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class DogAllOf: NSObject, Codable { +@objc public class DogAllOf: NSObject, Codable { public var breed: String? diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index 3c1c261393143597d37fcc6657292a67bb75a1ec..034a58c6c0eb641668224da4875b2a21347757f4 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class EnumArrays: NSObject, Codable { +@objc public class EnumArrays: NSObject, Codable { public enum JustSymbol: String, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -27,7 +25,7 @@ import Foundation self.arrayEnum = arrayEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justSymbol = "just_symbol" case arrayEnum = "array_enum" } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift index c2c639ba3246c2c7d30830770fc80529114eca31..d4029d73f8aff2b20baf7856bb6517a1407731b5 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -7,7 +7,6 @@ import Foundation - public enum EnumClass: String, Codable, CaseIterable { case abc = "_abc" case efg = "-efg" diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index 60b754914d42ecfe6a6386dc64639c8cb105a77e..ce3a03006097afdf7da96f1bbb7606907e6ef792 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class EnumTest: NSObject, Codable { +@objc public class EnumTest: NSObject, Codable { public enum EnumString: String, Codable, CaseIterable { case upper = "UPPER" @@ -43,7 +41,7 @@ import Foundation self.outerEnum = outerEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case enumString = "enum_string" case enumStringRequired = "enum_string_required" case enumInteger = "enum_integer" diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/File.swift index 120d5bb787974f73d4f488e0f7b8d4c0676344a0..7a320c177d387bb93ccbc3484ade0c6af02f8edc 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -9,7 +9,7 @@ import Foundation /** Must be named `File` for test. */ -@objc public class File: NSObject, Codable { +@objc public class File: NSObject, Codable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index e60109a85334fa63d782c4da8fd41273ad307b68..a6437b4fe9014f7fddeb9759e91b04ccb6dd8d25 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class FileSchemaTestClass: NSObject, Codable { +@objc public class FileSchemaTestClass: NSObject, Codable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 664481c02fc4d8e6a4e170233ef3796ce9e283cf..df2c46d3757b6e572052b811b76b0d64e89e53ba 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class FormatTest: NSObject, Codable { +@objc public class FormatTest: NSObject, Codable { public var integer: Int? public var integerNum: NSNumber? { diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index 974726b3e65de60cdbd289d0cd50e9912fce9e97..b9f5b39117d770173c6f3053335324ad85ebb1ae 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class HasOnlyReadOnly: NSObject, Codable { +@objc public class HasOnlyReadOnly: NSObject, Codable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 4942b7502244432ab0e3fd507d398a23201829a9..826dc9e27f2bf897d770ae8fdfba08a51180d998 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class List: NSObject, Codable { +@objc public class List: NSObject, Codable { public var _123list: String? @@ -17,7 +15,7 @@ import Foundation self._123list = _123list } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _123list = "123-list" } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index 2acd08f46a45fce28f7b9a7d006a14636340d995..2b97660b80e870038233e8e5fc790d17da47e0ad 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,27 +7,25 @@ import Foundation - - -@objc public class MapTest: NSObject, Codable { +@objc public class MapTest: NSObject, Codable { public enum MapOfEnumString: String, Codable, CaseIterable { case upper = "UPPER" case lower = "lower" } - public var mapMapOfString: [String:[String:String]]? - public var mapOfEnumString: [String:String]? - public var directMap: [String:Bool]? + public var mapMapOfString: [String: [String: String]]? + public var mapOfEnumString: [String: String]? + public var directMap: [String: Bool]? public var indirectMap: StringBooleanMap? - public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) { + public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { self.mapMapOfString = mapMapOfString self.mapOfEnumString = mapOfEnumString self.directMap = directMap self.indirectMap = indirectMap } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapMapOfString = "map_map_of_string" case mapOfEnumString = "map_of_enum_string" case directMap = "direct_map" diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 3ecb79bf9f431361eb68179481a066344384d058..e10adad0a7e1b0aab996532148d5c8d5b8b077e1 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,15 +7,13 @@ import Foundation - - -@objc public class MixedPropertiesAndAdditionalPropertiesClass: NSObject, Codable { +@objc public class MixedPropertiesAndAdditionalPropertiesClass: NSObject, Codable { public var uuid: UUID? public var dateTime: Date? - public var map: [String:Animal]? + public var map: [String: Animal]? - public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) { + public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { self.uuid = uuid self.dateTime = dateTime self.map = map diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index 031badf4be9e79292cafb75bd5eb89b5890f9fa0..1c5410f61ddea04df91bba3a3cfb110575a77099 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -9,7 +9,7 @@ import Foundation /** Model for testing model name starting with number */ -@objc public class Model200Response: NSObject, Codable { +@objc public class Model200Response: NSObject, Codable { public var name: Int? public var nameNum: NSNumber? { @@ -24,7 +24,7 @@ import Foundation self._class = _class } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case _class = "class" } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index c863b854d4684bfd2dc1eda4cc81176c0f325ee1..06f8a2f81a3a429ddc73f85e75ace11c13319394 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -9,7 +9,7 @@ import Foundation /** Model for testing model name same as property name */ -@objc public class Name: NSObject, Codable { +@objc public class Name: NSObject, Codable { public var name: Int public var snakeCase: Int? @@ -33,7 +33,7 @@ import Foundation self._123number = _123number } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case snakeCase = "snake_case" case property diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 1db3ace430478b979007f2a6b22feae45c01ab71..3bd9859378d8752a413163f6fc9eb83bb9dda74d 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class NumberOnly: NSObject, Codable { +@objc public class NumberOnly: NSObject, Codable { public var justNumber: Double? @@ -17,7 +15,7 @@ import Foundation self.justNumber = justNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justNumber = "JustNumber" } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index 5fdd493dbedb394c7d42e1c1ebd8ca05480a84fb..586a4c2d55a8dbacfa0534971dae0804f8d704b1 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class Order: NSObject, Codable { +@objc public class Order: NSObject, Codable { public enum Status: String, Codable, CaseIterable { case placed = "placed" @@ -53,7 +51,7 @@ import Foundation self.complete = complete } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _id = "id" case petId case quantity diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 0d1791d3fa8d80e41ed7364b533ee439a62ac1b3..434111678de7d36d74e7b4764fb26a4651dbb8fa 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class OuterComposite: NSObject, Codable { +@objc public class OuterComposite: NSObject, Codable { public var myNumber: Double? public var myString: String? @@ -26,7 +24,7 @@ import Foundation self.myBoolean = myBoolean } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case myNumber = "my_number" case myString = "my_string" case myBoolean = "my_boolean" diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift index 9e6b8d74e874c1d75bf8afbb92296996e39cf366..c3b778cbbed444c54045dedb48213ce3bb532dbf 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -7,7 +7,6 @@ import Foundation - public enum OuterEnum: String, Codable, CaseIterable { case placed = "placed" case approved = "approved" diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 29d4e3d9e37a0b140f876ef4bd931546ad33ad46..d84079a2b48dd41c4577d91bb1fb607fa8f48b2c 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class Pet: NSObject, Codable { +@objc public class Pet: NSObject, Codable { public enum Status: String, Codable, CaseIterable { case available = "available" @@ -38,7 +36,7 @@ import Foundation self.status = status } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _id = "id" case category case name diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index 2c806ac6d756b264b4891109d58dda01f61358f8..d1252433b2d8c8b092e264fdbf20543703d64056 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class ReadOnlyFirst: NSObject, Codable { +@objc public class ReadOnlyFirst: NSObject, Codable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index 948f6f4d3846687d8bca179e6b15e347c126bb55..4b10ac18cf0dda6eaeacb27ab465d0db53e023bb 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -9,7 +9,7 @@ import Foundation /** Model for testing reserved words */ -@objc public class Return: NSObject, Codable { +@objc public class Return: NSObject, Codable { public var _return: Int? public var _returnNum: NSNumber? { @@ -22,7 +22,7 @@ import Foundation self._return = _return } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _return = "return" } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index c01c4065998ba520b4561acdbbb4d83314e58118..85e33352531d4deba3da21cdf9c0920f19840ee2 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class SpecialModelName: NSObject, Codable { +@objc public class SpecialModelName: NSObject, Codable { public var specialPropertyName: Int64? public var specialPropertyNameNum: NSNumber? { @@ -22,7 +20,7 @@ import Foundation self.specialPropertyName = specialPropertyName } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case specialPropertyName = "$special[property.name]" } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index 3116d99bff0cdaedc0ebbb4596c26749e1ad408a..ffe9730a6fe4fd2266c1bd780cd4ae40b7cd6adc 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,12 +7,9 @@ import Foundation +@objc public class StringBooleanMap: NSObject, Codable { - -@objc public class StringBooleanMap: NSObject, Codable { - - - public var additionalProperties: [String:Bool] = [:] + public var additionalProperties: [String: Bool] = [:] public subscript(key: String) -> Bool? { get { @@ -45,5 +42,4 @@ import Foundation additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 1bd7489826dd75b192d0edcdae53199b3cda190e..88583be7f5ddc8baffb7400e4d07238d8f6c35a9 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class Tag: NSObject, Codable { +@objc public class Tag: NSObject, Codable { public var _id: Int64? public var _idNum: NSNumber? { @@ -24,7 +22,7 @@ import Foundation self.name = name } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _id = "id" case name } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index 273b7b31aefd0afd5b054f66a15da74e13527100..6d51f44540c01e909902c5ef30c84aaeea5aba22 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class TypeHolderDefault: NSObject, Codable { +@objc public class TypeHolderDefault: NSObject, Codable { public var stringItem: String = "what" public var numberItem: Double @@ -25,7 +23,7 @@ import Foundation self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index 3cb1929d43941df470b6c4963d1395eb9d345195..40e3a41c34d9844d9177d71bfa29b3f150c70b67 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class TypeHolderExample: NSObject, Codable { +@objc public class TypeHolderExample: NSObject, Codable { public var stringItem: String public var numberItem: Double @@ -25,7 +23,7 @@ import Foundation self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/User.swift index eb8ec05527419dde9e35ea4e2886067a0a85c603..7dc3cc5954d63513910940a8aa81c801be746ea9 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,9 +7,7 @@ import Foundation - - -@objc public class User: NSObject, Codable { +@objc public class User: NSObject, Codable { public var _id: Int64? public var _idNum: NSNumber? { @@ -42,7 +40,7 @@ import Foundation self.userStatus = userStatus } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _id = "id" case username case firstName 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 22261e2ce9483f4ac59c12ff516a53863a606132..55d0eb42191942998769644daea74ffeb51cbcd7 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -14,7 +14,7 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { return URLSessionRequestBuilder<T>.self } - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type { + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { return URLSessionDecodableRequestBuilder<T>.self } } @@ -23,16 +23,16 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { private var urlSessionStore = SynchronizedDictionary<String, URLSession>() open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - + private var observation: NSKeyValueObservation? - + deinit { observation?.invalidate() } - + // swiftlint:disable:next weak_delegate fileprivate let sessionDelegate = SessionDelegate() - + /** May be assigned if you want to control the authentication challenges. */ @@ -45,11 +45,11 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - retry the request. */ public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? - - required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { + + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } - + /** May be overridden by a subclass if you want to control the URLSession configuration. @@ -77,40 +77,40 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { May be overridden by a subclass if you want to control the URLRequest configuration (e.g. to override the cache policy). */ - open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) throws -> URLRequest { - + open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { + guard let url = URL(string: URLString) else { throw DownloadException.requestMissingURL } - + var originalRequest = URLRequest(url: url) - + originalRequest.httpMethod = method.rawValue - + buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + headers.forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) - + return modifiedRequest } override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { - let urlSessionId:String = UUID().uuidString + let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() urlSessionStore[urlSessionId] = urlSession - + let parameters: [String: Any] = self.parameters ?? [:] - + let fileKeys = parameters.filter { $1 is URL } .map { $0.0 } - + let encoding: ParameterEncoding if fileKeys.count > 0 { encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) @@ -119,29 +119,29 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } else { encoding = URLEncoding() } - + guard let xMethod = HTTPMethod(rawValue: method) else { fatalError("Unsuported Http method - \(method)") } - + let cleanupRequest = { urlSessionStore[urlSessionId] = nil self.observation?.invalidate() } - + do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - + let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - + guard let self = self else { return } - + if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - + taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - + guard let self = self else { return } - + if shouldRetry { cleanupRequest() self.execute(apiResponseQueue, completion) @@ -157,13 +157,13 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } } - + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { onProgressReady?(dataTask.progress) } - + dataTask.resume() - + } catch { apiResponseQueue.async { cleanupRequest() @@ -172,7 +172,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } - + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -192,52 +192,52 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is URL.Type: do { - + guard error == nil else { throw DownloadException.responseFailed } - + guard let data = data else { throw DownloadException.responseDataMissing } - + let fileManager = FileManager.default let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] let requestURL = try self.getURL(from: urlRequest) - + var requestPath = try self.getPath(from: requestURL) - + if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { requestPath = requestPath.appending("/\(headerFileName)") } - + let filePath = documentsDirectory.appendingPathComponent(requestPath) let directoryPath = filePath.deletingLastPathComponent().path - + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) - + completion(.success(Response(response: httpResponse, body: filePath as? T))) - + } catch let requestParserError as DownloadException { completion(.failure(ErrorResponse.error(400, data, requestParserError))) } catch let error { completion(.failure(ErrorResponse.error(400, data, error))) } - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + default: - + completion(.success(Response(response: httpResponse, body: data as? T))) } @@ -251,7 +251,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { guard let contentDisposition = contentDisposition else { return nil @@ -270,7 +270,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { filename = contentItem return filename? - .replacingCharacters(in: range, with:"") + .replacingCharacters(in: range, with: "") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } @@ -279,7 +279,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getPath(from url : URL) throws -> String { + fileprivate func getPath(from url: URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath @@ -293,7 +293,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL @@ -304,7 +304,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } -open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuilder<T> { +open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -324,28 +324,28 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + case is Data.Type: - + completion(.success(Response(response: httpResponse, body: data as? T))) - + default: - + guard let data = data, !data.isEmpty else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse))) return } - + let decodeResult = CodableHelper.decode(T.self, from: data) - + switch decodeResult { case let .success(decodableObj): completion(.success(Response(response: httpResponse, body: decodableObj))) @@ -356,10 +356,10 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil } } -fileprivate class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { - +private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { + var credential: URLCredential? - + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { @@ -402,13 +402,13 @@ public protocol ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest } -fileprivate class URLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) throws -> URLRequest { - +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - + guard let parameters = parameters else { return urlRequest } - + guard let url = urlRequest.url else { throw DownloadException.requestMissingURL } @@ -417,12 +417,12 @@ fileprivate class URLEncoding: ParameterEncoding { urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) urlRequest.url = urlComponents.url } - + return urlRequest } } -fileprivate class FileUploadEncoding: ParameterEncoding { +private class FileUploadEncoding: ParameterEncoding { let contentTypeForFormPart: (_ fileURL: URL) -> String? @@ -433,13 +433,13 @@ fileprivate class FileUploadEncoding: ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { var urlRequest = urlRequest - + guard let parameters = parameters, !parameters.isEmpty else { return urlRequest } - + let boundary = "Boundary-\(UUID().uuidString)" - + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") for (key, value) in parameters { @@ -479,7 +479,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { fatalError("Unprocessable value \(value) with key \(key)") } } - + var body = urlRequest.httpBody.orEmpty body.append("\r\n--\(boundary)--\r\n") @@ -494,7 +494,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { var urlRequest = urlRequest var body = urlRequest.httpBody.orEmpty - + let fileData = try Data(contentsOf: fileURL) let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) @@ -502,7 +502,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } @@ -518,20 +518,20 @@ fileprivate class FileUploadEncoding: ParameterEncoding { // The value data. body.append(fileData) - + urlRequest.httpBody = body return urlRequest } - + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { var urlRequest = urlRequest - + var body = urlRequest.httpBody.orEmpty // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } diff --git a/samples/client/petstore/swift5/promisekitLibrary/Package.swift b/samples/client/petstore/swift5/promisekitLibrary/Package.swift index 10dac40538466e5d216dbf25845e1947f6cf3335..4445c9794907b5d7a3fd813c65113484323f454d 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/Package.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/Package.swift @@ -14,19 +14,19 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "PetstoreClient", - targets: ["PetstoreClient"]), + targets: ["PetstoreClient"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/mxcl/PromiseKit.git", from: "6.12.0"), + .package(url: "https://github.com/mxcl/PromiseKit.git", from: "6.12.0") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "PetstoreClient", - dependencies: ["PromiseKit", ], + dependencies: ["PromiseKit" ], path: "PetstoreClient/Classes" - ), + ) ] ) diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 2404bc8ffc6d6a190b82327193d4b5b2325dd515..5b09f9557113d4bc4d0ca8b0b05b4f408008c2ff 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,7 +7,7 @@ import Foundation public struct APIHelper { - public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,17 +20,17 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? Array<Any?> { - result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" } } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { guard let source = source else { return nil } @@ -46,15 +46,15 @@ public struct APIHelper { } public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? Array<Any?> { + if let collection = source as? [Any?] { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? Array<Any?> { + if let collection = item.value as? [Any?] { collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in result.append(URLQueryItem(name: item.key, value: value)) } @@ -69,4 +69,3 @@ public struct APIHelper { return destination } } - diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index c5d1b9b42df33641cc1c81227a5027da0da95336..a5c2d605dff6f91df4130c2ff02d09919bae6974 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,15 +9,15 @@ import Foundation open class PetstoreClientAPI { public static var basePath = "http://petstore.swagger.io:80/v2" public static var credential: URLCredential? - public static var customHeaders: [String:String] = [:] + public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder<T> { var credential: URLCredential? - var headers: [String:String] - public let parameters: [String:Any]? + var headers: [String: String] + public let parameters: [String: Any]? public let isBody: Bool public let method: String public let URLString: String @@ -25,9 +25,9 @@ open class RequestBuilder<T> { /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. /// If you need to get the request's progress in older OS versions, please use Alamofire http client. - public var onProgressReady: ((Progress) -> ())? + public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -37,7 +37,7 @@ open class RequestBuilder<T> { addHeaders(PetstoreClientAPI.customHeaders) } - open func addHeaders(_ aHeaders:[String:String]) { + open func addHeaders(_ aHeaders: [String: String]) { for (header, value) in aHeaders { headers[header] = value } @@ -60,5 +60,5 @@ open class RequestBuilder<T> { public protocol RequestBuilderFactory { func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index ffce4d7c4e81d8a10aeab46ded7a313ec80dd023..c3a97ff074c11056ed1e6836a28f64e24365d931 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -8,8 +8,6 @@ import Foundation import PromiseKit - - open class AnotherFakeAPI { /** To test special tags diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 47b6ec5f196f8e4bef0360e6898c696564b1986a..80153ba634d34661bc0708ba471970d370cb5179 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -8,8 +8,6 @@ import Foundation import PromiseKit - - open class FakeAPI { /** @@ -203,7 +201,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise<Void> */ - open class func testBodyWithQueryParams( query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<Void> { + open class func testBodyWithQueryParams( query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<Void> { let deferred = Promise<Void>.pending() testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in switch result { @@ -296,7 +294,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise<Void> */ - 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) -> Promise<Void> { + 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) -> Promise<Void> { let deferred = Promise<Void>.pending() testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { @@ -335,7 +333,7 @@ open class FakeAPI { open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), @@ -354,7 +352,7 @@ open class FakeAPI { let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -443,7 +441,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise<Void> */ - 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) -> Promise<Void> { + 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) -> Promise<Void> { let deferred = Promise<Void>.pending() testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result -> Void in switch result { @@ -473,19 +471,19 @@ open class FakeAPI { open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "enum_form_string_array": enumFormStringArray?.encodeToJSON(), "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), - "enum_query_string": enumQueryString?.encodeToJSON(), - "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -511,7 +509,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise<Void> */ - open class func testGroupParameters( requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<Void> { + open class func testGroupParameters( requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<Void> { let deferred = Promise<Void>.pending() testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result -> Void in switch result { @@ -539,13 +537,13 @@ open class FakeAPI { open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": requiredStringGroup.encodeToJSON(), - "required_int64_group": requiredInt64Group.encodeToJSON(), - "string_group": stringGroup?.encodeToJSON(), + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -566,7 +564,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise<Void> */ - open class func testInlineAdditionalProperties( param: [String:String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<Void> { + open class func testInlineAdditionalProperties( param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<Void> { let deferred = Promise<Void>.pending() testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in switch result { @@ -585,7 +583,7 @@ open class FakeAPI { - parameter param: (body) request body - returns: RequestBuilder<Void> */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> { let path = "/fake/inline-additionalProperties" let URLString = PetstoreClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) @@ -605,7 +603,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise<Void> */ - open class func testJsonFormData( param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<Void> { + open class func testJsonFormData( param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<Void> { let deferred = Promise<Void>.pending() testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in switch result { @@ -628,14 +626,14 @@ open class FakeAPI { open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "param": param.encodeToJSON(), "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index e749c654de5c2188582b9b89a2bcdc2806dffb73..3a05f8eaf60e283c22dac3653c4fb75e24b4d4fa 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -8,8 +8,6 @@ import Foundation import PromiseKit - - open class FakeClassnameTags123API { /** To test class name in snake case diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 88269c38385ba507ccf42aa9232641c8119bacd4..18d3fd1d094f08c995a03df664c94486647e8e70 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -8,8 +8,6 @@ import Foundation import PromiseKit - - open class PetAPI { /** Add a new pet to the store @@ -60,7 +58,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise<Void> */ - open class func deletePet( petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<Void> { + open class func deletePet( petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<Void> { let deferred = Promise<Void>.pending() deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in switch result { @@ -89,8 +87,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ "api_key": apiKey?.encodeToJSON() @@ -144,8 +142,8 @@ open class PetAPI { open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "status": status.encodeToJSON() @@ -191,8 +189,8 @@ open class PetAPI { open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "tags": tags.encodeToJSON() @@ -239,8 +237,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -298,7 +296,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise<Void> */ - open class func updatePetWithForm( petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<Void> { + open class func updatePetWithForm( petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<Void> { let deferred = Promise<Void>.pending() updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in switch result { @@ -328,14 +326,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "name": name?.encodeToJSON(), "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -352,7 +350,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise<ApiResponse> */ - open class func uploadFile( petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<ApiResponse> { + open class func uploadFile( petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<ApiResponse> { let deferred = Promise<ApiResponse>.pending() uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { @@ -382,14 +380,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -406,7 +404,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise<ApiResponse> */ - open class func uploadFileWithRequiredFile( petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<ApiResponse> { + open class func uploadFileWithRequiredFile( petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<ApiResponse> { let deferred = Promise<ApiResponse>.pending() uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { @@ -436,14 +434,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 9bb66f3699f7f7ff7ed77bd0d316f4d2227478aa..20fc8a1468c78249dcc3f3e64df6d90da7af2207 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -8,8 +8,6 @@ import Foundation import PromiseKit - - open class StoreAPI { /** Delete purchase order by ID @@ -44,8 +42,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -59,8 +57,8 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise<[String:Int]> */ - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<[String:Int]> { - let deferred = Promise<[String:Int]>.pending() + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<[String: Int]> { + let deferred = Promise<[String: Int]>.pending() getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -81,14 +79,14 @@ open class StoreAPI { - name: api_key - returns: RequestBuilder<[String:Int]> */ - open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { let path = "/store/inventory" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } @@ -126,8 +124,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 237961c96a08000ce0f067db44bd8fa362de762a..89c48c3b28f8ac61820f2a4325681847adbd262c 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -8,8 +8,6 @@ import Foundation import PromiseKit - - open class UserAPI { /** Create user @@ -159,8 +157,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -200,8 +198,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -217,7 +215,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise<String> */ - open class func loginUser( username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<String> { + open class func loginUser( username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<String> { let deferred = Promise<String>.pending() loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in switch result { @@ -241,11 +239,11 @@ open class UserAPI { open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username.encodeToJSON(), + "username": username.encodeToJSON(), "password": password.encodeToJSON() ]) @@ -281,8 +279,8 @@ open class UserAPI { open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -298,7 +296,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Promise<Void> */ - open class func updateUser( username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<Void> { + open class func updateUser( username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Promise<Void> { let deferred = Promise<Void>.pending() updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in switch result { diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 01b28a4bd42d21245b26f53ba2766a44c3ff0d38..ef971ebadc60ae1d358d9d87e8727aa13ec7437b 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -45,4 +45,4 @@ open class CodableHelper { open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { return Swift.Result { try self.jsonEncoder.encode(value) } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift index f171525e43944f9cedf0e5146a39752fc2e848dc..627d9adb757ef30f3bf44723748aee6b5f1913d9 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,10 +7,10 @@ import Foundation open class Configuration { - + // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} \ No newline at end of file + +} 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 5b98ba296730144d33371244b86fd73bcb6b43bc..736702ea5dd9b33a93a39189093637ab55cc6f31 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -109,24 +109,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { if let values = values { try encodeArray(values, forKey: key) } } - public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable { + public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable { + public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -136,7 +136,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -148,8 +148,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { - var tmpArray: [T]? = nil + public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? if contains(key) { tmpArray = try decodeArray(T.self, forKey: key) @@ -158,8 +158,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable { - var map: [Self.Key : T] = [:] + public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -180,7 +180,7 @@ extension HTTPURLResponse { } extension RequestBuilder { - public func execute() -> Promise<Response<T>> { + public func execute() -> Promise<Response<T>> { let deferred = Promise<Response<T>>.pending() self.execute { result in switch result { diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift index 08f1ef334dff10656c28e298c6b9b6d754159d73..b79e9f5e64d518e51552c62467884931ee1eaf3c 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -41,7 +41,7 @@ public struct JSONDataEncoding { } public static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? = nil + var returnedParams: [String: Any]? if let jsonData = jsonData, !jsonData.isEmpty { var params: [String: Any] = [:] params[jsonDataKey] = jsonData diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 314f1eff1f9b07d17db1930bfbe566baedbbc5cc..02f78ffb47056ddebac110679c4b545ed2861125 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -9,8 +9,8 @@ import Foundation open class JSONEncodingHelper { - open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? = nil + open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? // Encode the Encodable object if let encodableObj = encodableObj { @@ -27,7 +27,7 @@ open class JSONEncodingHelper { } open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? = nil + var params: [String: Any]? if let encodableObj = encodableObj { do { @@ -41,5 +41,5 @@ open class JSONEncodingHelper { return params } - + } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift index 11e81ffcc472bbe9ca94aecdf5b731470979d0de..c0542c14c0812d73834b48ba2123704b096bd61c 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,11 +10,11 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse : Error { +public enum ErrorResponse: Error { case error(Int, Data?, Error) } -public enum DownloadException : Error { +public enum DownloadException: Error { case responseDataMissing case responseFailed case requestMissing @@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error { case generalError(Error) } - open class Response<T> { public let statusCode: Int public let header: [String: String] @@ -44,7 +43,7 @@ open class Response<T> { public convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String:String]() + var header = [String: String]() for (key, value) in rawHeader { if let key = key.base as? String, let value = value as? String { header[key] = value diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 28ca8377b889b8436d0d11797c89daaa27864e9f..1af0315359678116da5f18a94457d0d2a1178e51 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,19 +7,17 @@ import Foundation +public struct AdditionalPropertiesClass: Codable { -public struct AdditionalPropertiesClass: Codable { + public var mapString: [String: String]? + public var mapMapString: [String: [String: String]]? - - public var mapString: [String:String]? - public var mapMapString: [String:[String:String]]? - - public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { + public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { self.mapString = mapString self.mapMapString = mapMapString } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapString = "map_string" case mapMapString = "map_map_string" } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index 1050d79dbe9df42e68f40f036c83f858d3cfd441..5ed9f31e2a364d0bf7a25bdf70cecb48af6ab5c4 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Animal: Codable { - +public struct Animal: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift index e7bea63f8ed28132865ea4d3c23eab55666cf4f6..e09b0e9efdc8ca7798114f24aff21f57e8f9fabd 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -7,5 +7,4 @@ import Foundation - public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index 4d0393b9ba45fb26499017214280bf04637ebe09..ec270da8907438877ee5cc303b093ceba3993297 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ApiResponse: Codable { - +public struct ApiResponse: Codable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 1363c96394baf0514e28045c00399b49591a962d..6c252ed475b2ed17ed9cd5a9eee4db0348886338 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfArrayOfNumberOnly: Codable { - +public struct ArrayOfArrayOfNumberOnly: Codable { public var arrayArrayNumber: [[Double]]? @@ -17,7 +15,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable { self.arrayArrayNumber = arrayArrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayArrayNumber = "ArrayArrayNumber" } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index 6b8873730c43cabe3911148ca8edc15b468d0a17..e84eb5d650258b37fdd423fadcfe1c7fc63962df 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfNumberOnly: Codable { - +public struct ArrayOfNumberOnly: Codable { public var arrayNumber: [Double]? @@ -17,7 +15,7 @@ public struct ArrayOfNumberOnly: Codable { self.arrayNumber = arrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayNumber = "ArrayNumber" } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index 64f7c6d9db99f4927f985c425f33a0d435c7d701..d2140933d1817725be708b41da4e996a549f3896 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayTest: Codable { - +public struct ArrayTest: Codable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? @@ -21,7 +19,7 @@ public struct ArrayTest: Codable { self.arrayArrayOfModel = arrayArrayOfModel } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayOfString = "array_of_string" case arrayArrayOfInteger = "array_array_of_integer" case arrayArrayOfModel = "array_array_of_model" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index ddb669a590459e81909408e9d2d9bc40dadfd38e..d1b3b27616edc9a2da27adb54c6b95ce056f8e91 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Capitalization: Codable { - +public struct Capitalization: Codable { public var smallCamel: String? public var capitalCamel: String? @@ -28,7 +26,7 @@ public struct Capitalization: Codable { self.ATT_NAME = ATT_NAME } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case smallCamel case capitalCamel = "CapitalCamel" case smallSnake = "small_Snake" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index c4f6e0d488caad736393f8a8936e5db63fec5378..7ab887f3113f1dd39f42b1019d8f58d45325f288 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Cat: Codable { - +public struct Cat: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift index 7b1d7e32be80ed62c3c1dda290093a4ea02a6c7b..a51ad0dffab1ba129591056cd816575af0e1ea09 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct CatAllOf: Codable { - +public struct CatAllOf: Codable { public var declawed: Bool? diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 3ec00f5ab10d19c5cd961c6316c9ec7960a85c57..eb8f7e5e1974989058473e4492c25c0004f1078c 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Category: Codable { - +public struct Category: Codable { public var id: Int64? public var name: String = "default-name" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index af030c3dd6269b59f42af7280976d3fa9dee9425..e2a7d4427a061dd104df50c1922ab1446e549106 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Codable { - +public struct ClassModel: Codable { public var _class: String? diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index 0aae748c76b4398015bcac633f082d0fbd84531a..00245ca37280eea9c87184eb0f40fb8bf03b81f2 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Client: Codable { - +public struct Client: Codable { public var client: String? diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 198e28b94dd6615a5da1b5c9efd0e13c3150de4a..492c1228008eb782ea0f927f65259ce2c7999d24 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Dog: Codable { - +public struct Dog: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift index 8ff49b2af23fc129b73f3bfc3e4c8a6d95b16ea5..7786f8acc5ae7d0de7de7248ef5a94d4d16f0a17 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct DogAllOf: Codable { - +public struct DogAllOf: Codable { public var breed: String? diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index e2d3fa04f94b92473f218965cf21bb8eb8e82ee2..9844e7c40e35868546bb256fd806eb8b30b135f2 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumArrays: Codable { - +public struct EnumArrays: Codable { public enum JustSymbol: String, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -27,7 +25,7 @@ public struct EnumArrays: Codable { self.arrayEnum = arrayEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justSymbol = "just_symbol" case arrayEnum = "array_enum" } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift index c2c639ba3246c2c7d30830770fc80529114eca31..d4029d73f8aff2b20baf7856bb6517a1407731b5 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -7,7 +7,6 @@ import Foundation - public enum EnumClass: String, Codable, CaseIterable { case abc = "_abc" case efg = "-efg" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index a56e1f36389b91b5bf92522d6248b9fc69d3c386..789f583e1d778b6b26d6270fe386e3b88b406488 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumTest: Codable { - +public struct EnumTest: Codable { public enum EnumString: String, Codable, CaseIterable { case upper = "UPPER" @@ -43,7 +41,7 @@ public struct EnumTest: Codable { self.outerEnum = outerEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case enumString = "enum_string" case enumStringRequired = "enum_string_required" case enumInteger = "enum_integer" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift index 773b53b2cb765586e3a14e4034a7c8da7a177363..abf3ccffc48588b98475607b17878c7d03320f48 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,8 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Codable { - +public struct File: Codable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 83dc1148cfa3d6e9bbcb2d78f2d62b38045668b6..532f1457939af300b65f89821673cf1951ec2f0b 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FileSchemaTestClass: Codable { - +public struct FileSchemaTestClass: Codable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index bccd3f9fb1786b11e4d4dc8e97ca6bd3e73f4cab..20bd6d103b3dc87ffa6d7f38b21d957318628930 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FormatTest: Codable { - +public struct FormatTest: Codable { public var integer: Int? public var int32: Int? diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index 566d71a35ef0193c3e0ca140a6adabfcdc84588f..906ddb06fb170e5de30f07754fce3efc4f512ee1 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct HasOnlyReadOnly: Codable { - +public struct HasOnlyReadOnly: Codable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 80cecab242f25976c3ac5b7538ca07f7d1a1e1b8..fe13d302ccbfde321339be7d09f6932248c2570e 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,9 +7,7 @@ import Foundation - -public struct List: Codable { - +public struct List: Codable { public var _123list: String? @@ -17,7 +15,7 @@ public struct List: Codable { self._123list = _123list } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _123list = "123-list" } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index f0c02de95f7abe0f4bd7fac695d9c590120d8504..4b6037f378ee6b0152805f8b11d374a16373e222 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,27 +7,25 @@ import Foundation - -public struct MapTest: Codable { - +public struct MapTest: Codable { public enum MapOfEnumString: String, Codable, CaseIterable { case upper = "UPPER" case lower = "lower" } - public var mapMapOfString: [String:[String:String]]? - public var mapOfEnumString: [String:String]? - public var directMap: [String:Bool]? + public var mapMapOfString: [String: [String: String]]? + public var mapOfEnumString: [String: String]? + public var directMap: [String: Bool]? public var indirectMap: StringBooleanMap? - public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) { + public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { self.mapMapOfString = mapMapOfString self.mapOfEnumString = mapOfEnumString self.directMap = directMap self.indirectMap = indirectMap } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapMapOfString = "map_map_of_string" case mapOfEnumString = "map_of_enum_string" case directMap = "direct_map" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 710e62a9b5875c830a4885dac70b0bedb56d32b2..c3deb2f28932f5d0ab338f3da2ac398de24a8822 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,15 +7,13 @@ import Foundation - -public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { - +public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { public var uuid: UUID? public var dateTime: Date? - public var map: [String:Animal]? + public var map: [String: Animal]? - public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) { + public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { self.uuid = uuid self.dateTime = dateTime self.map = map diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index 450a53b918ca0d82e9697268575f6315bd76e1c7..b61db7d6e716185b1b6f21ac2c536f3d5e408809 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Codable { - +public struct Model200Response: Codable { public var name: Int? public var _class: String? @@ -19,7 +18,7 @@ public struct Model200Response: Codable { self._class = _class } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case _class = "class" } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index 6deb69fcd7313698cb05f790654c47f98a303665..8ab4db44b73a3726cc854651fef382bd9fcf69b6 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Codable { - +public struct Name: Codable { public var name: Int public var snakeCase: Int? @@ -23,7 +22,7 @@ public struct Name: Codable { self._123number = _123number } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case snakeCase = "snake_case" case property diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 0c9ee2b7b9f4a7fcd3a7c1ed1e142e8fcce4cf84..4d1dafcc2c1f56bf9c7e317734efc71ee9fbd09a 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct NumberOnly: Codable { - +public struct NumberOnly: Codable { public var justNumber: Double? @@ -17,7 +15,7 @@ public struct NumberOnly: Codable { self.justNumber = justNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justNumber = "JustNumber" } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index ab0eac0b304e4a248aa897d86579bde395947b77..40c30cc8609c33fd59240aae30ba7d942e4d3659 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Order: Codable { - +public struct Order: Codable { public enum Status: String, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 4a7d227104413d7065789fa87b4c2f41078130a0..18c3a024f1227af549fb1b13b1838f1e81a837b1 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,9 +7,7 @@ import Foundation - -public struct OuterComposite: Codable { - +public struct OuterComposite: Codable { public var myNumber: Double? public var myString: String? @@ -21,7 +19,7 @@ public struct OuterComposite: Codable { self.myBoolean = myBoolean } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case myNumber = "my_number" case myString = "my_string" case myBoolean = "my_boolean" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift index 9e6b8d74e874c1d75bf8afbb92296996e39cf366..c3b778cbbed444c54045dedb48213ce3bb532dbf 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -7,7 +7,6 @@ import Foundation - public enum OuterEnum: String, Codable, CaseIterable { case placed = "placed" case approved = "approved" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index a973071d6c9615c7e082183ec555eb794bb11b3b..b9ce0e933256c401ced1143aaa31936cf60bdb63 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Pet: Codable { - +public struct Pet: Codable { public enum Status: String, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index b2a6b7e2b8a61e14c75f22de2da766e96afc1fca..0acd21fd10000317ffc9f96840a49b3dd538d0c7 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ReadOnlyFirst: Codable { - +public struct ReadOnlyFirst: Codable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index 7e089dcee2b4a366353619ee201eb067bb63ed71..c223f993a69ece3abf5451c68d01eb666dad5b19 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Codable { - +public struct Return: Codable { public var _return: Int? @@ -17,7 +16,7 @@ public struct Return: Codable { self._return = _return } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _return = "return" } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index e890ef952520010cb37b71b4f4c06215b4f7c88c..6e8650f76d8ece4a8511cf0afacf62816e852598 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,9 +7,7 @@ import Foundation - -public struct SpecialModelName: Codable { - +public struct SpecialModelName: Codable { public var specialPropertyName: Int64? @@ -17,7 +15,7 @@ public struct SpecialModelName: Codable { self.specialPropertyName = specialPropertyName } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case specialPropertyName = "$special[property.name]" } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index f65ae0623d6e8567ed17f651d3c0ff056fefb1ba..3f1237fee477a298b1d99cef8062371e2f101f59 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,12 +7,9 @@ import Foundation +public struct StringBooleanMap: Codable { -public struct StringBooleanMap: Codable { - - - - public var additionalProperties: [String:Bool] = [:] + public var additionalProperties: [String: Bool] = [:] public subscript(key: String) -> Bool? { get { @@ -45,5 +42,4 @@ public struct StringBooleanMap: Codable { additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index a91b6061bcf78c8ad31d4ae87401afa4ac72330b..4dd8a9a9f5a0fc547c88401b39caf0f00cddd61d 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Tag: Codable { - +public struct Tag: Codable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index 2d377c3edb02c59cbf82ae4bc9534eba7c3f3e2b..a9e088808ed378dfa9690f8dfa1fc687294bd3bd 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderDefault: Codable { - +public struct TypeHolderDefault: Codable { public var stringItem: String = "what" public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderDefault: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index e5eb92da696e19c998edd122f874f9f7fa776148..dff4083ae43260c42e61413843b52749b26b6769 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderExample: Codable { - +public struct TypeHolderExample: Codable { public var stringItem: String public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderExample: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift index f70328ca9e597ffca3abc70b5340fda99848a4d1..79f271ed73564b8af07f2698e649f38062255ce7 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,9 +7,7 @@ import Foundation - -public struct User: Codable { - +public struct User: Codable { public var id: Int64? public var username: String? 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 22261e2ce9483f4ac59c12ff516a53863a606132..55d0eb42191942998769644daea74ffeb51cbcd7 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -14,7 +14,7 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { return URLSessionRequestBuilder<T>.self } - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type { + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { return URLSessionDecodableRequestBuilder<T>.self } } @@ -23,16 +23,16 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { private var urlSessionStore = SynchronizedDictionary<String, URLSession>() open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - + private var observation: NSKeyValueObservation? - + deinit { observation?.invalidate() } - + // swiftlint:disable:next weak_delegate fileprivate let sessionDelegate = SessionDelegate() - + /** May be assigned if you want to control the authentication challenges. */ @@ -45,11 +45,11 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - retry the request. */ public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? - - required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { + + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } - + /** May be overridden by a subclass if you want to control the URLSession configuration. @@ -77,40 +77,40 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { May be overridden by a subclass if you want to control the URLRequest configuration (e.g. to override the cache policy). */ - open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) throws -> URLRequest { - + open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { + guard let url = URL(string: URLString) else { throw DownloadException.requestMissingURL } - + var originalRequest = URLRequest(url: url) - + originalRequest.httpMethod = method.rawValue - + buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + headers.forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) - + return modifiedRequest } override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { - let urlSessionId:String = UUID().uuidString + let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() urlSessionStore[urlSessionId] = urlSession - + let parameters: [String: Any] = self.parameters ?? [:] - + let fileKeys = parameters.filter { $1 is URL } .map { $0.0 } - + let encoding: ParameterEncoding if fileKeys.count > 0 { encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) @@ -119,29 +119,29 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } else { encoding = URLEncoding() } - + guard let xMethod = HTTPMethod(rawValue: method) else { fatalError("Unsuported Http method - \(method)") } - + let cleanupRequest = { urlSessionStore[urlSessionId] = nil self.observation?.invalidate() } - + do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - + let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - + guard let self = self else { return } - + if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - + taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - + guard let self = self else { return } - + if shouldRetry { cleanupRequest() self.execute(apiResponseQueue, completion) @@ -157,13 +157,13 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } } - + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { onProgressReady?(dataTask.progress) } - + dataTask.resume() - + } catch { apiResponseQueue.async { cleanupRequest() @@ -172,7 +172,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } - + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -192,52 +192,52 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is URL.Type: do { - + guard error == nil else { throw DownloadException.responseFailed } - + guard let data = data else { throw DownloadException.responseDataMissing } - + let fileManager = FileManager.default let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] let requestURL = try self.getURL(from: urlRequest) - + var requestPath = try self.getPath(from: requestURL) - + if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { requestPath = requestPath.appending("/\(headerFileName)") } - + let filePath = documentsDirectory.appendingPathComponent(requestPath) let directoryPath = filePath.deletingLastPathComponent().path - + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) - + completion(.success(Response(response: httpResponse, body: filePath as? T))) - + } catch let requestParserError as DownloadException { completion(.failure(ErrorResponse.error(400, data, requestParserError))) } catch let error { completion(.failure(ErrorResponse.error(400, data, error))) } - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + default: - + completion(.success(Response(response: httpResponse, body: data as? T))) } @@ -251,7 +251,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { guard let contentDisposition = contentDisposition else { return nil @@ -270,7 +270,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { filename = contentItem return filename? - .replacingCharacters(in: range, with:"") + .replacingCharacters(in: range, with: "") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } @@ -279,7 +279,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getPath(from url : URL) throws -> String { + fileprivate func getPath(from url: URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath @@ -293,7 +293,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL @@ -304,7 +304,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } -open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuilder<T> { +open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -324,28 +324,28 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + case is Data.Type: - + completion(.success(Response(response: httpResponse, body: data as? T))) - + default: - + guard let data = data, !data.isEmpty else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse))) return } - + let decodeResult = CodableHelper.decode(T.self, from: data) - + switch decodeResult { case let .success(decodableObj): completion(.success(Response(response: httpResponse, body: decodableObj))) @@ -356,10 +356,10 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil } } -fileprivate class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { - +private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { + var credential: URLCredential? - + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { @@ -402,13 +402,13 @@ public protocol ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest } -fileprivate class URLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) throws -> URLRequest { - +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - + guard let parameters = parameters else { return urlRequest } - + guard let url = urlRequest.url else { throw DownloadException.requestMissingURL } @@ -417,12 +417,12 @@ fileprivate class URLEncoding: ParameterEncoding { urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) urlRequest.url = urlComponents.url } - + return urlRequest } } -fileprivate class FileUploadEncoding: ParameterEncoding { +private class FileUploadEncoding: ParameterEncoding { let contentTypeForFormPart: (_ fileURL: URL) -> String? @@ -433,13 +433,13 @@ fileprivate class FileUploadEncoding: ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { var urlRequest = urlRequest - + guard let parameters = parameters, !parameters.isEmpty else { return urlRequest } - + let boundary = "Boundary-\(UUID().uuidString)" - + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") for (key, value) in parameters { @@ -479,7 +479,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { fatalError("Unprocessable value \(value) with key \(key)") } } - + var body = urlRequest.httpBody.orEmpty body.append("\r\n--\(boundary)--\r\n") @@ -494,7 +494,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { var urlRequest = urlRequest var body = urlRequest.httpBody.orEmpty - + let fileData = try Data(contentsOf: fileURL) let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) @@ -502,7 +502,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } @@ -518,20 +518,20 @@ fileprivate class FileUploadEncoding: ParameterEncoding { // The value data. body.append(fileData) - + urlRequest.httpBody = body return urlRequest } - + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { var urlRequest = urlRequest - + var body = urlRequest.httpBody.orEmpty // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } diff --git a/samples/client/petstore/swift5/readonlyProperties/Package.swift b/samples/client/petstore/swift5/readonlyProperties/Package.swift index 79f6f81887383d4539292942c364aed2cfcfb5c6..96dfff54edf415c3c22de54b2758012c629b6f79 100644 --- a/samples/client/petstore/swift5/readonlyProperties/Package.swift +++ b/samples/client/petstore/swift5/readonlyProperties/Package.swift @@ -14,7 +14,7 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "PetstoreClient", - targets: ["PetstoreClient"]), + targets: ["PetstoreClient"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -26,6 +26,6 @@ let package = Package( name: "PetstoreClient", dependencies: [], path: "PetstoreClient/Classes" - ), + ) ] ) diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 2404bc8ffc6d6a190b82327193d4b5b2325dd515..5b09f9557113d4bc4d0ca8b0b05b4f408008c2ff 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,7 +7,7 @@ import Foundation public struct APIHelper { - public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,17 +20,17 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? Array<Any?> { - result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" } } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { guard let source = source else { return nil } @@ -46,15 +46,15 @@ public struct APIHelper { } public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? Array<Any?> { + if let collection = source as? [Any?] { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? Array<Any?> { + if let collection = item.value as? [Any?] { collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in result.append(URLQueryItem(name: item.key, value: value)) } @@ -69,4 +69,3 @@ public struct APIHelper { return destination } } - diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs.swift index c5d1b9b42df33641cc1c81227a5027da0da95336..a5c2d605dff6f91df4130c2ff02d09919bae6974 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,15 +9,15 @@ import Foundation open class PetstoreClientAPI { public static var basePath = "http://petstore.swagger.io:80/v2" public static var credential: URLCredential? - public static var customHeaders: [String:String] = [:] + public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder<T> { var credential: URLCredential? - var headers: [String:String] - public let parameters: [String:Any]? + var headers: [String: String] + public let parameters: [String: Any]? public let isBody: Bool public let method: String public let URLString: String @@ -25,9 +25,9 @@ open class RequestBuilder<T> { /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. /// If you need to get the request's progress in older OS versions, please use Alamofire http client. - public var onProgressReady: ((Progress) -> ())? + public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -37,7 +37,7 @@ open class RequestBuilder<T> { addHeaders(PetstoreClientAPI.customHeaders) } - open func addHeaders(_ aHeaders:[String:String]) { + open func addHeaders(_ aHeaders: [String: String]) { for (header, value) in aHeaders { headers[header] = value } @@ -60,5 +60,5 @@ open class RequestBuilder<T> { public protocol RequestBuilderFactory { func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index bb3ae717825412b9adeed7bb5ddda32ea74185ec..5bbf323f820cd3132cf60e1d11dbf21e55944156 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class AnotherFakeAPI { /** To test special tags @@ -17,7 +15,7 @@ open class AnotherFakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index d1d81faa335c4ea18856b16a52b2ee7cc0054f3a..134d6aea416a97039b668ee963e2c53f0df2d6d3 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class FakeAPI { /** @@ -16,7 +14,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?,_ error: Error?) -> Void)) { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) { fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -51,7 +49,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) { fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -86,7 +84,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?,_ error: Error?) -> Void)) { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) { fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -121,7 +119,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -156,7 +154,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -192,7 +190,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -231,7 +229,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -281,7 +279,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -318,7 +316,7 @@ open class FakeAPI { open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), @@ -337,7 +335,7 @@ open class FakeAPI { let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -426,7 +424,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -454,19 +452,19 @@ open class FakeAPI { open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "enum_form_string_array": enumFormStringArray?.encodeToJSON(), "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), - "enum_query_string": enumQueryString?.encodeToJSON(), - "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -492,7 +490,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -518,13 +516,13 @@ open class FakeAPI { open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": requiredStringGroup.encodeToJSON(), - "required_int64_group": requiredInt64Group.encodeToJSON(), - "string_group": stringGroup?.encodeToJSON(), + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -545,7 +543,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testInlineAdditionalProperties(param: [String:String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -562,7 +560,7 @@ open class FakeAPI { - parameter param: (body) request body - returns: RequestBuilder<Void> */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> { let path = "/fake/inline-additionalProperties" let URLString = PetstoreClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) @@ -582,7 +580,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -603,14 +601,14 @@ open class FakeAPI { open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "param": param.encodeToJSON(), "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index d21c4a49d43d099eaa7ffc901ca9ff1884235915..48cfe7187b9a6740385db65efbbdef7fb6164a7f 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -7,8 +7,6 @@ import Foundation - - open class FakeClassnameTags123API { /** To test class name in snake case @@ -17,7 +15,7 @@ open class FakeClassnameTags123API { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index f5366f5832baf471018f15f4d04882347e77df85..c938db7200472ab06b8c2f0a29c7660aec7cb118 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class PetAPI { /** Add a new pet to the store @@ -17,7 +15,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -57,7 +55,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -84,8 +82,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ "api_key": apiKey?.encodeToJSON() @@ -113,7 +111,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -137,8 +135,8 @@ open class PetAPI { open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "status": status.encodeToJSON() @@ -157,7 +155,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -182,8 +180,8 @@ open class PetAPI { open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "tags": tags.encodeToJSON() @@ -201,7 +199,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?,_ error: Error?) -> Void)) { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) { getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,8 +226,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -244,7 +242,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -285,7 +283,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -313,14 +311,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "name": name?.encodeToJSON(), "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -337,7 +335,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -365,14 +363,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -389,7 +387,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -417,14 +415,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 3848eda85ad69cbca414345076b6c6a1eeea6bc3..a8a83eda39a4e7ee3a7cc86e3ce0d0bc26e7182c 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class StoreAPI { /** Delete purchase order by ID @@ -17,7 +15,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -41,8 +39,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -56,7 +54,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String:Int]?,_ error: Error?) -> Void)) { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) { getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -76,14 +74,14 @@ open class StoreAPI { - name: api_key - returns: RequestBuilder<[String:Int]> */ - open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { let path = "/store/inventory" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } @@ -95,7 +93,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -119,8 +117,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -135,7 +133,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 546166841d9e6987c83402f734038868be6c3997..505ed1b0c5c9995b0bc45aa233212d11a8e515e9 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class UserAPI { /** Create user @@ -17,7 +15,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -54,7 +52,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -90,7 +88,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -126,7 +124,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -150,8 +148,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -166,7 +164,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?,_ error: Error?) -> Void)) { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) { getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -189,8 +187,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -206,7 +204,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,11 +226,11 @@ open class UserAPI { open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username.encodeToJSON(), + "username": username.encodeToJSON(), "password": password.encodeToJSON() ]) @@ -247,7 +245,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -266,8 +264,8 @@ open class UserAPI { open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -283,7 +281,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 01b28a4bd42d21245b26f53ba2766a44c3ff0d38..ef971ebadc60ae1d358d9d87e8727aa13ec7437b 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -45,4 +45,4 @@ open class CodableHelper { open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { return Swift.Result { try self.jsonEncoder.encode(value) } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Configuration.swift index f171525e43944f9cedf0e5146a39752fc2e848dc..627d9adb757ef30f3bf44723748aee6b5f1913d9 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,10 +7,10 @@ import Foundation open class Configuration { - + // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} \ No newline at end of file + +} 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 6e279679c67a1e7e3f302fc0fcbfd5b58a6dd12f..93ed6b90b376a7b84e9eabb1705f3dcb8bd98a14 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -108,24 +108,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { if let values = values { try encodeArray(values, forKey: key) } } - public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable { + public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable { + public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { - var tmpArray: [T]? = nil + public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? if contains(key) { tmpArray = try decodeArray(T.self, forKey: key) @@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable { - var map: [Self.Key : T] = [:] + public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -177,5 +177,3 @@ extension HTTPURLResponse { return Array(200 ..< 300).contains(statusCode) } } - - diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift index 08f1ef334dff10656c28e298c6b9b6d754159d73..b79e9f5e64d518e51552c62467884931ee1eaf3c 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -41,7 +41,7 @@ public struct JSONDataEncoding { } public static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? = nil + var returnedParams: [String: Any]? if let jsonData = jsonData, !jsonData.isEmpty { var params: [String: Any] = [:] params[jsonDataKey] = jsonData diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 314f1eff1f9b07d17db1930bfbe566baedbbc5cc..02f78ffb47056ddebac110679c4b545ed2861125 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -9,8 +9,8 @@ import Foundation open class JSONEncodingHelper { - open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? = nil + open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? // Encode the Encodable object if let encodableObj = encodableObj { @@ -27,7 +27,7 @@ open class JSONEncodingHelper { } open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? = nil + var params: [String: Any]? if let encodableObj = encodableObj { do { @@ -41,5 +41,5 @@ open class JSONEncodingHelper { return params } - + } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models.swift index 11e81ffcc472bbe9ca94aecdf5b731470979d0de..c0542c14c0812d73834b48ba2123704b096bd61c 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,11 +10,11 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse : Error { +public enum ErrorResponse: Error { case error(Int, Data?, Error) } -public enum DownloadException : Error { +public enum DownloadException: Error { case responseDataMissing case responseFailed case requestMissing @@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error { case generalError(Error) } - open class Response<T> { public let statusCode: Int public let header: [String: String] @@ -44,7 +43,7 @@ open class Response<T> { public convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String:String]() + var header = [String: String]() for (key, value) in rawHeader { if let key = key.base as? String, let value = value as? String { header[key] = value diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 341b729479e81c6e47bd98ae4abf558e90bdb4e0..3fda7052a7d377a1c6c5c5e4973da0d52fc56a9e 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,19 +7,17 @@ import Foundation +public struct AdditionalPropertiesClass: Codable { -public struct AdditionalPropertiesClass: Codable { + public private(set) var mapString: [String: String]? + public private(set) var mapMapString: [String: [String: String]]? - - public private(set) var mapString: [String:String]? - public private(set) var mapMapString: [String:[String:String]]? - - public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { + public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { self.mapString = mapString self.mapMapString = mapMapString } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapString = "map_string" case mapMapString = "map_map_string" } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index fc8bdfae7d5c5fc92e7cc133f924a52bf9e50b88..af59c2a9ef628723098a810306373d5ce7d15069 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Animal: Codable { - +public struct Animal: Codable { public private(set) var className: String public private(set) var color: String? = "red" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift index e7bea63f8ed28132865ea4d3c23eab55666cf4f6..e09b0e9efdc8ca7798114f24aff21f57e8f9fabd 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -7,5 +7,4 @@ import Foundation - public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index 48e052b3802d3d0cc19627015b70606f52644b51..a89768595cc535c49dbe6257647d9fcfc28ad3f8 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ApiResponse: Codable { - +public struct ApiResponse: Codable { public private(set) var code: Int? public private(set) var type: String? diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 08f1b7e89b7c042c851ddf92d9bd93637e3eaad1..a2593b7c1a39c13ae927226327d56f847a5bd35f 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfArrayOfNumberOnly: Codable { - +public struct ArrayOfArrayOfNumberOnly: Codable { public private(set) var arrayArrayNumber: [[Double]]? @@ -17,7 +15,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable { self.arrayArrayNumber = arrayArrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayArrayNumber = "ArrayArrayNumber" } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index 579f65acb928eb7f7a61b522df88540a43bfb999..c5edf1100537cc15b516f106a1419654a7e9d6bc 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfNumberOnly: Codable { - +public struct ArrayOfNumberOnly: Codable { public private(set) var arrayNumber: [Double]? @@ -17,7 +15,7 @@ public struct ArrayOfNumberOnly: Codable { self.arrayNumber = arrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayNumber = "ArrayNumber" } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index 8fdf0a2869095323b909c82b53a16699acff8927..8ad39b8c09fcacb866c579cb79a6b18d583cd4e1 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayTest: Codable { - +public struct ArrayTest: Codable { public private(set) var arrayOfString: [String]? public private(set) var arrayArrayOfInteger: [[Int64]]? @@ -21,7 +19,7 @@ public struct ArrayTest: Codable { self.arrayArrayOfModel = arrayArrayOfModel } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayOfString = "array_of_string" case arrayArrayOfInteger = "array_array_of_integer" case arrayArrayOfModel = "array_array_of_model" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index f4c7a90c3a8552d705fe6de1e696c74b74ed5097..eb3d6777e52bd4019bbc81403634eeeb0b1f084d 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Capitalization: Codable { - +public struct Capitalization: Codable { public private(set) var smallCamel: String? public private(set) var capitalCamel: String? @@ -28,7 +26,7 @@ public struct Capitalization: Codable { self.ATT_NAME = ATT_NAME } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case smallCamel case capitalCamel = "CapitalCamel" case smallSnake = "small_Snake" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index 3e509835b0b6be04018811b2f591710bec61a3a1..2978b016f98ea11a4bde73dde052d2b9ff32936e 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Cat: Codable { - +public struct Cat: Codable { public private(set) var className: String public private(set) var color: String? = "red" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift index f1627ee097a4c38fd807372224cc5cbd35108731..4ab80fbcd99e9737bc4ed61ffbe042ba39ad22fe 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct CatAllOf: Codable { - +public struct CatAllOf: Codable { public private(set) var declawed: Bool? diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index bce83565cabca38915b5b998293746019dbf8f0b..3482703a6b41b3db918a724712596dfe434a2469 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Category: Codable { - +public struct Category: Codable { public private(set) var id: Int64? public private(set) var name: String = "default-name" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index 1d6271aef8a5dbd15733dd4dd34a2cb025f4942b..319d88a70f7a0c8a08a8fce45e80a4f4a87be33a 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Codable { - +public struct ClassModel: Codable { public private(set) var _class: String? diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index 1e06ac73271d7b542c707128c059936a8d9fb2c1..5dd8cc3062dd1e532230dfb80e06f24a028c3200 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Client: Codable { - +public struct Client: Codable { public private(set) var client: String? diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index fde6641dd77cf42ade269b4e6559c9e596b080c4..16ab196b87248edcd905fda0a67f0d04e47a71f3 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Dog: Codable { - +public struct Dog: Codable { public private(set) var className: String public private(set) var color: String? = "red" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift index 26d6da9def44d2b9e475a42d4817c82d6b15c602..d8a838725cbf159b817d858c589f76e96a9ccfb5 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct DogAllOf: Codable { - +public struct DogAllOf: Codable { public private(set) var breed: String? diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index faa0ba8afb1f957e7a9c32859598d824cbb08414..d9ce69e9fc86d48a9261a77396b78fc7368101f6 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumArrays: Codable { - +public struct EnumArrays: Codable { public enum JustSymbol: String, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -27,7 +25,7 @@ public struct EnumArrays: Codable { self.arrayEnum = arrayEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justSymbol = "just_symbol" case arrayEnum = "array_enum" } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift index c2c639ba3246c2c7d30830770fc80529114eca31..d4029d73f8aff2b20baf7856bb6517a1407731b5 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -7,7 +7,6 @@ import Foundation - public enum EnumClass: String, Codable, CaseIterable { case abc = "_abc" case efg = "-efg" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index 576278be14d9eeffdf66d53dd525d3811f340d3b..2b114d422d1b515bb39b741689bd199a63c386a6 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumTest: Codable { - +public struct EnumTest: Codable { public enum EnumString: String, Codable, CaseIterable { case upper = "UPPER" @@ -43,7 +41,7 @@ public struct EnumTest: Codable { self.outerEnum = outerEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case enumString = "enum_string" case enumStringRequired = "enum_string_required" case enumInteger = "enum_integer" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/File.swift index 81dac248edae6648ec18b0c0af32d6e6164b7a5c..eeab5819441526ebe720f844cbd837e7dd122773 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,8 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Codable { - +public struct File: Codable { /** Test capitalization */ public private(set) var sourceURI: String? diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 4be9d64d2f267112e9eeed38add5ec0080087156..94574ca9955bd5ca9850bd6ddcc87f5882cca25b 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FileSchemaTestClass: Codable { - +public struct FileSchemaTestClass: Codable { public private(set) var file: File? public private(set) var files: [File]? diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 152b1b6277f4ab89a1ba0aba5ff3fd3fcddde6dc..57bbd464b51044b2ee03042c3ce7ef6af226aaa9 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FormatTest: Codable { - +public struct FormatTest: Codable { public private(set) var integer: Int? public private(set) var int32: Int? diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index 78b14697863fecf3660c1b0c641b161db2bea829..4de261f092d224ca3dd0b99638433ac1aeccbb0a 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct HasOnlyReadOnly: Codable { - +public struct HasOnlyReadOnly: Codable { public private(set) var bar: String? public private(set) var foo: String? diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 50e66b8c199a008fab5aae92224a514edc8a0865..135160ff8de25a93e904e82f0bfcbdfac0652f08 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,9 +7,7 @@ import Foundation - -public struct List: Codable { - +public struct List: Codable { public private(set) var _123list: String? @@ -17,7 +15,7 @@ public struct List: Codable { self._123list = _123list } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _123list = "123-list" } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index 2df0bccb30393fc9e3828e8d7324141fc39bb440..ebd9dd5b5bc7586de79d0ec541bcad32c688f73f 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,27 +7,25 @@ import Foundation - -public struct MapTest: Codable { - +public struct MapTest: Codable { public enum MapOfEnumString: String, Codable, CaseIterable { case upper = "UPPER" case lower = "lower" } - public private(set) var mapMapOfString: [String:[String:String]]? - public private(set) var mapOfEnumString: [String:String]? - public private(set) var directMap: [String:Bool]? + public private(set) var mapMapOfString: [String: [String: String]]? + public private(set) var mapOfEnumString: [String: String]? + public private(set) var directMap: [String: Bool]? public private(set) var indirectMap: StringBooleanMap? - public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) { + public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { self.mapMapOfString = mapMapOfString self.mapOfEnumString = mapOfEnumString self.directMap = directMap self.indirectMap = indirectMap } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapMapOfString = "map_map_of_string" case mapOfEnumString = "map_of_enum_string" case directMap = "direct_map" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index c8cac41d37b1b93605960cdc63c93f17e1098637..dc1ee0461be7b216ab81f3af4276858dd9550eec 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,15 +7,13 @@ import Foundation - -public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { - +public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { public private(set) var uuid: UUID? public private(set) var dateTime: Date? - public private(set) var map: [String:Animal]? + public private(set) var map: [String: Animal]? - public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) { + public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { self.uuid = uuid self.dateTime = dateTime self.map = map diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index ded3fb6912c6005a8ce461b0a3fee7858e81f207..a0f7127ef65c9b3e7ece1c382d27411afcb0994b 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Codable { - +public struct Model200Response: Codable { public private(set) var name: Int? public private(set) var _class: String? @@ -19,7 +18,7 @@ public struct Model200Response: Codable { self._class = _class } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case _class = "class" } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index 98f02ee6e9d7368ba7bafe527277306ed304c915..ee70b1f6ee9bb4fd992e4d7c815cfa3cdee132e4 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Codable { - +public struct Name: Codable { public private(set) var name: Int public private(set) var snakeCase: Int? @@ -23,7 +22,7 @@ public struct Name: Codable { self._123number = _123number } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case snakeCase = "snake_case" case property diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 8555908ced4374218f495788910baa4b4bcb141b..007dfab800ce2e6da2d2c25eb833c55f567c2035 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct NumberOnly: Codable { - +public struct NumberOnly: Codable { public private(set) var justNumber: Double? @@ -17,7 +15,7 @@ public struct NumberOnly: Codable { self.justNumber = justNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justNumber = "JustNumber" } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index 6e2f5e57710cf976c9b7caafdd89923e245d1bcd..41a1d7d664e775db3d18aa339dae79dfc40e1a0a 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Order: Codable { - +public struct Order: Codable { public enum Status: String, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index ae7f8e53f7f15eb4af7e0d72374b85a2375a9f06..df6d2512d6e4ada1a8da106d662add746accaf7d 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,9 +7,7 @@ import Foundation - -public struct OuterComposite: Codable { - +public struct OuterComposite: Codable { public private(set) var myNumber: Double? public private(set) var myString: String? @@ -21,7 +19,7 @@ public struct OuterComposite: Codable { self.myBoolean = myBoolean } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case myNumber = "my_number" case myString = "my_string" case myBoolean = "my_boolean" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift index 9e6b8d74e874c1d75bf8afbb92296996e39cf366..c3b778cbbed444c54045dedb48213ce3bb532dbf 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -7,7 +7,6 @@ import Foundation - public enum OuterEnum: String, Codable, CaseIterable { case placed = "placed" case approved = "approved" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 95e4aea41c261bfddc97f5c234238d9ff70d2f1a..7b99ef33751a0dbb28be672cf7fac2df67af6f43 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Pet: Codable { - +public struct Pet: Codable { public enum Status: String, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index 17f4a4c49646bb4bf4ab1ce45f2c21dc02c519c7..30cd4837cc785b8668d5c9c12323724ca3a5f684 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ReadOnlyFirst: Codable { - +public struct ReadOnlyFirst: Codable { public private(set) var bar: String? public private(set) var baz: String? diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index cf81158bec9b2fa061fc8b0c03b319b778bfd107..b28b6e99d7775abf457a466bfe541593d85232a9 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Codable { - +public struct Return: Codable { public private(set) var _return: Int? @@ -17,7 +16,7 @@ public struct Return: Codable { self._return = _return } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _return = "return" } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index f3b2e7cf40b589d2ba442a844deeeaa0207ee2e5..266833a0dbc6753a4f1e00cdb2dc15605618a058 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,9 +7,7 @@ import Foundation - -public struct SpecialModelName: Codable { - +public struct SpecialModelName: Codable { public private(set) var specialPropertyName: Int64? @@ -17,7 +15,7 @@ public struct SpecialModelName: Codable { self.specialPropertyName = specialPropertyName } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case specialPropertyName = "$special[property.name]" } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index 9642286b2630779b7c44765439d61651f7346e70..dbd5afe27091128c3a5408d8b82cdd5d2ec47548 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,12 +7,9 @@ import Foundation +public struct StringBooleanMap: Codable { -public struct StringBooleanMap: Codable { - - - - public private(set) var additionalProperties: [String:Bool] = [:] + public private(set) var additionalProperties: [String: Bool] = [:] public subscript(key: String) -> Bool? { get { @@ -45,5 +42,4 @@ public struct StringBooleanMap: Codable { additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - } diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 4f97c69f683253638b056e884000fdcad66f130e..f827ccf107adc8937ad91699e01ed1d1f0a69088 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Tag: Codable { - +public struct Tag: Codable { public private(set) var id: Int64? public private(set) var name: String? diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index 528a2bdd07c159c7c725f28c47d26c0d55a165e9..ed3641fdb2fc380c209394576ddc93a21613e696 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderDefault: Codable { - +public struct TypeHolderDefault: Codable { public private(set) var stringItem: String = "what" public private(set) var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderDefault: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index 5d68a286685cf2671af7a375089d2753dd56a015..4985005bdaf15bed833578f09023c5fad27928a3 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderExample: Codable { - +public struct TypeHolderExample: Codable { public private(set) var stringItem: String public private(set) var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderExample: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/User.swift index be82224b262824f764c6f4237040f40b3d22fb0f..9fba7de81820c2989f188ef91398ffd8d2e37c52 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,9 +7,7 @@ import Foundation - -public struct User: Codable { - +public struct User: Codable { public private(set) var id: Int64? public private(set) var username: String? 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 22261e2ce9483f4ac59c12ff516a53863a606132..55d0eb42191942998769644daea74ffeb51cbcd7 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -14,7 +14,7 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { return URLSessionRequestBuilder<T>.self } - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type { + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { return URLSessionDecodableRequestBuilder<T>.self } } @@ -23,16 +23,16 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { private var urlSessionStore = SynchronizedDictionary<String, URLSession>() open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - + private var observation: NSKeyValueObservation? - + deinit { observation?.invalidate() } - + // swiftlint:disable:next weak_delegate fileprivate let sessionDelegate = SessionDelegate() - + /** May be assigned if you want to control the authentication challenges. */ @@ -45,11 +45,11 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - retry the request. */ public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? - - required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { + + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } - + /** May be overridden by a subclass if you want to control the URLSession configuration. @@ -77,40 +77,40 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { May be overridden by a subclass if you want to control the URLRequest configuration (e.g. to override the cache policy). */ - open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) throws -> URLRequest { - + open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { + guard let url = URL(string: URLString) else { throw DownloadException.requestMissingURL } - + var originalRequest = URLRequest(url: url) - + originalRequest.httpMethod = method.rawValue - + buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + headers.forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) - + return modifiedRequest } override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { - let urlSessionId:String = UUID().uuidString + let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() urlSessionStore[urlSessionId] = urlSession - + let parameters: [String: Any] = self.parameters ?? [:] - + let fileKeys = parameters.filter { $1 is URL } .map { $0.0 } - + let encoding: ParameterEncoding if fileKeys.count > 0 { encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) @@ -119,29 +119,29 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } else { encoding = URLEncoding() } - + guard let xMethod = HTTPMethod(rawValue: method) else { fatalError("Unsuported Http method - \(method)") } - + let cleanupRequest = { urlSessionStore[urlSessionId] = nil self.observation?.invalidate() } - + do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - + let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - + guard let self = self else { return } - + if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - + taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - + guard let self = self else { return } - + if shouldRetry { cleanupRequest() self.execute(apiResponseQueue, completion) @@ -157,13 +157,13 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } } - + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { onProgressReady?(dataTask.progress) } - + dataTask.resume() - + } catch { apiResponseQueue.async { cleanupRequest() @@ -172,7 +172,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } - + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -192,52 +192,52 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is URL.Type: do { - + guard error == nil else { throw DownloadException.responseFailed } - + guard let data = data else { throw DownloadException.responseDataMissing } - + let fileManager = FileManager.default let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] let requestURL = try self.getURL(from: urlRequest) - + var requestPath = try self.getPath(from: requestURL) - + if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { requestPath = requestPath.appending("/\(headerFileName)") } - + let filePath = documentsDirectory.appendingPathComponent(requestPath) let directoryPath = filePath.deletingLastPathComponent().path - + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) - + completion(.success(Response(response: httpResponse, body: filePath as? T))) - + } catch let requestParserError as DownloadException { completion(.failure(ErrorResponse.error(400, data, requestParserError))) } catch let error { completion(.failure(ErrorResponse.error(400, data, error))) } - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + default: - + completion(.success(Response(response: httpResponse, body: data as? T))) } @@ -251,7 +251,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { guard let contentDisposition = contentDisposition else { return nil @@ -270,7 +270,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { filename = contentItem return filename? - .replacingCharacters(in: range, with:"") + .replacingCharacters(in: range, with: "") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } @@ -279,7 +279,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getPath(from url : URL) throws -> String { + fileprivate func getPath(from url: URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath @@ -293,7 +293,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL @@ -304,7 +304,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } -open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuilder<T> { +open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -324,28 +324,28 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + case is Data.Type: - + completion(.success(Response(response: httpResponse, body: data as? T))) - + default: - + guard let data = data, !data.isEmpty else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse))) return } - + let decodeResult = CodableHelper.decode(T.self, from: data) - + switch decodeResult { case let .success(decodableObj): completion(.success(Response(response: httpResponse, body: decodableObj))) @@ -356,10 +356,10 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil } } -fileprivate class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { - +private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { + var credential: URLCredential? - + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { @@ -402,13 +402,13 @@ public protocol ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest } -fileprivate class URLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) throws -> URLRequest { - +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - + guard let parameters = parameters else { return urlRequest } - + guard let url = urlRequest.url else { throw DownloadException.requestMissingURL } @@ -417,12 +417,12 @@ fileprivate class URLEncoding: ParameterEncoding { urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) urlRequest.url = urlComponents.url } - + return urlRequest } } -fileprivate class FileUploadEncoding: ParameterEncoding { +private class FileUploadEncoding: ParameterEncoding { let contentTypeForFormPart: (_ fileURL: URL) -> String? @@ -433,13 +433,13 @@ fileprivate class FileUploadEncoding: ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { var urlRequest = urlRequest - + guard let parameters = parameters, !parameters.isEmpty else { return urlRequest } - + let boundary = "Boundary-\(UUID().uuidString)" - + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") for (key, value) in parameters { @@ -479,7 +479,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { fatalError("Unprocessable value \(value) with key \(key)") } } - + var body = urlRequest.httpBody.orEmpty body.append("\r\n--\(boundary)--\r\n") @@ -494,7 +494,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { var urlRequest = urlRequest var body = urlRequest.httpBody.orEmpty - + let fileData = try Data(contentsOf: fileURL) let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) @@ -502,7 +502,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } @@ -518,20 +518,20 @@ fileprivate class FileUploadEncoding: ParameterEncoding { // The value data. body.append(fileData) - + urlRequest.httpBody = body return urlRequest } - + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { var urlRequest = urlRequest - + var body = urlRequest.httpBody.orEmpty // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } diff --git a/samples/client/petstore/swift5/resultLibrary/Package.swift b/samples/client/petstore/swift5/resultLibrary/Package.swift index 79f6f81887383d4539292942c364aed2cfcfb5c6..96dfff54edf415c3c22de54b2758012c629b6f79 100644 --- a/samples/client/petstore/swift5/resultLibrary/Package.swift +++ b/samples/client/petstore/swift5/resultLibrary/Package.swift @@ -14,7 +14,7 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "PetstoreClient", - targets: ["PetstoreClient"]), + targets: ["PetstoreClient"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -26,6 +26,6 @@ let package = Package( name: "PetstoreClient", dependencies: [], path: "PetstoreClient/Classes" - ), + ) ] ) diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 2404bc8ffc6d6a190b82327193d4b5b2325dd515..5b09f9557113d4bc4d0ca8b0b05b4f408008c2ff 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,7 +7,7 @@ import Foundation public struct APIHelper { - public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,17 +20,17 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? Array<Any?> { - result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" } } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { guard let source = source else { return nil } @@ -46,15 +46,15 @@ public struct APIHelper { } public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? Array<Any?> { + if let collection = source as? [Any?] { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? Array<Any?> { + if let collection = item.value as? [Any?] { collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in result.append(URLQueryItem(name: item.key, value: value)) } @@ -69,4 +69,3 @@ public struct APIHelper { return destination } } - diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index c5d1b9b42df33641cc1c81227a5027da0da95336..a5c2d605dff6f91df4130c2ff02d09919bae6974 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,15 +9,15 @@ import Foundation open class PetstoreClientAPI { public static var basePath = "http://petstore.swagger.io:80/v2" public static var credential: URLCredential? - public static var customHeaders: [String:String] = [:] + public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder<T> { var credential: URLCredential? - var headers: [String:String] - public let parameters: [String:Any]? + var headers: [String: String] + public let parameters: [String: Any]? public let isBody: Bool public let method: String public let URLString: String @@ -25,9 +25,9 @@ open class RequestBuilder<T> { /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. /// If you need to get the request's progress in older OS versions, please use Alamofire http client. - public var onProgressReady: ((Progress) -> ())? + public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -37,7 +37,7 @@ open class RequestBuilder<T> { addHeaders(PetstoreClientAPI.customHeaders) } - open func addHeaders(_ aHeaders:[String:String]) { + open func addHeaders(_ aHeaders: [String: String]) { for (header, value) in aHeaders { headers[header] = value } @@ -60,5 +60,5 @@ open class RequestBuilder<T> { public protocol RequestBuilderFactory { func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index a2e5a2ab250c95ffc90b1c1d26be28426b15f11f..001f71608114a655e407ad559f01c6a877b88f3e 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class AnotherFakeAPI { /** To test special tags diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index e891da3f12e86f02638aaf8c5058093ec8234050..1289d6e2a94a047dd807e1aaeeba5259d070fe4f 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class FakeAPI { /** @@ -318,7 +316,7 @@ open class FakeAPI { open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), @@ -337,7 +335,7 @@ open class FakeAPI { let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -454,19 +452,19 @@ open class FakeAPI { open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "enum_form_string_array": enumFormStringArray?.encodeToJSON(), "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), - "enum_query_string": enumQueryString?.encodeToJSON(), - "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -518,13 +516,13 @@ open class FakeAPI { open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": requiredStringGroup.encodeToJSON(), - "required_int64_group": requiredInt64Group.encodeToJSON(), - "string_group": stringGroup?.encodeToJSON(), + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -545,7 +543,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func testInlineAdditionalProperties(param: [String:String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -562,7 +560,7 @@ open class FakeAPI { - parameter param: (body) request body - returns: RequestBuilder<Void> */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> { let path = "/fake/inline-additionalProperties" let URLString = PetstoreClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) @@ -603,14 +601,14 @@ open class FakeAPI { open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "param": param.encodeToJSON(), "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 84cf6f9a09e6bbe856bca0c6146d1b09a60c2830..f54d6e7fcf02879f3c8932149ed539d9159f2de3 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -7,8 +7,6 @@ import Foundation - - open class FakeClassnameTags123API { /** To test class name in snake case diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index f35144f8e57b2a3744af25c3194edd4fc661b916..92893a31295ccd56dde65414b31656dc547fc847 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class PetAPI { /** Add a new pet to the store @@ -84,8 +82,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ "api_key": apiKey?.encodeToJSON() @@ -137,8 +135,8 @@ open class PetAPI { open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "status": status.encodeToJSON() @@ -182,8 +180,8 @@ open class PetAPI { open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "tags": tags.encodeToJSON() @@ -228,8 +226,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -313,14 +311,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "name": name?.encodeToJSON(), "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -365,14 +363,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -417,14 +415,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 3990c38d237ffb7a175bdbe8c0f0bd0d14edcc09..5024c9dc8f637ce55e77cfc0e1ff6d34651efed7 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class StoreAPI { /** Delete purchase order by ID @@ -41,8 +39,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -56,7 +54,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<[String:Int], Error>) -> Void)) { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<[String: Int], Error>) -> Void)) { getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -76,14 +74,14 @@ open class StoreAPI { - name: api_key - returns: RequestBuilder<[String:Int]> */ - open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { let path = "/store/inventory" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } @@ -119,8 +117,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index ee4c7a5f35f290b9d2a6186183fa1b231d1122c7..c96c572b50c0c0a347890c715f0dc0fbc5471905 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class UserAPI { /** Create user @@ -150,8 +148,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -189,8 +187,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -228,11 +226,11 @@ open class UserAPI { open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username.encodeToJSON(), + "username": username.encodeToJSON(), "password": password.encodeToJSON() ]) @@ -266,8 +264,8 @@ open class UserAPI { open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 01b28a4bd42d21245b26f53ba2766a44c3ff0d38..ef971ebadc60ae1d358d9d87e8727aa13ec7437b 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -45,4 +45,4 @@ open class CodableHelper { open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { return Swift.Result { try self.jsonEncoder.encode(value) } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift index f171525e43944f9cedf0e5146a39752fc2e848dc..627d9adb757ef30f3bf44723748aee6b5f1913d9 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,10 +7,10 @@ import Foundation open class Configuration { - + // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} \ No newline at end of file + +} 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 6e279679c67a1e7e3f302fc0fcbfd5b58a6dd12f..93ed6b90b376a7b84e9eabb1705f3dcb8bd98a14 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -108,24 +108,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { if let values = values { try encodeArray(values, forKey: key) } } - public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable { + public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable { + public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { - var tmpArray: [T]? = nil + public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? if contains(key) { tmpArray = try decodeArray(T.self, forKey: key) @@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable { - var map: [Self.Key : T] = [:] + public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -177,5 +177,3 @@ extension HTTPURLResponse { return Array(200 ..< 300).contains(statusCode) } } - - diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift index 08f1ef334dff10656c28e298c6b9b6d754159d73..b79e9f5e64d518e51552c62467884931ee1eaf3c 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -41,7 +41,7 @@ public struct JSONDataEncoding { } public static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? = nil + var returnedParams: [String: Any]? if let jsonData = jsonData, !jsonData.isEmpty { var params: [String: Any] = [:] params[jsonDataKey] = jsonData diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 314f1eff1f9b07d17db1930bfbe566baedbbc5cc..02f78ffb47056ddebac110679c4b545ed2861125 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -9,8 +9,8 @@ import Foundation open class JSONEncodingHelper { - open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? = nil + open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? // Encode the Encodable object if let encodableObj = encodableObj { @@ -27,7 +27,7 @@ open class JSONEncodingHelper { } open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? = nil + var params: [String: Any]? if let encodableObj = encodableObj { do { @@ -41,5 +41,5 @@ open class JSONEncodingHelper { return params } - + } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift index 11e81ffcc472bbe9ca94aecdf5b731470979d0de..c0542c14c0812d73834b48ba2123704b096bd61c 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,11 +10,11 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse : Error { +public enum ErrorResponse: Error { case error(Int, Data?, Error) } -public enum DownloadException : Error { +public enum DownloadException: Error { case responseDataMissing case responseFailed case requestMissing @@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error { case generalError(Error) } - open class Response<T> { public let statusCode: Int public let header: [String: String] @@ -44,7 +43,7 @@ open class Response<T> { public convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String:String]() + var header = [String: String]() for (key, value) in rawHeader { if let key = key.base as? String, let value = value as? String { header[key] = value diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 28ca8377b889b8436d0d11797c89daaa27864e9f..1af0315359678116da5f18a94457d0d2a1178e51 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,19 +7,17 @@ import Foundation +public struct AdditionalPropertiesClass: Codable { -public struct AdditionalPropertiesClass: Codable { + public var mapString: [String: String]? + public var mapMapString: [String: [String: String]]? - - public var mapString: [String:String]? - public var mapMapString: [String:[String:String]]? - - public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { + public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { self.mapString = mapString self.mapMapString = mapMapString } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapString = "map_string" case mapMapString = "map_map_string" } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index 1050d79dbe9df42e68f40f036c83f858d3cfd441..5ed9f31e2a364d0bf7a25bdf70cecb48af6ab5c4 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Animal: Codable { - +public struct Animal: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift index e7bea63f8ed28132865ea4d3c23eab55666cf4f6..e09b0e9efdc8ca7798114f24aff21f57e8f9fabd 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -7,5 +7,4 @@ import Foundation - public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index 4d0393b9ba45fb26499017214280bf04637ebe09..ec270da8907438877ee5cc303b093ceba3993297 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ApiResponse: Codable { - +public struct ApiResponse: Codable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 1363c96394baf0514e28045c00399b49591a962d..6c252ed475b2ed17ed9cd5a9eee4db0348886338 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfArrayOfNumberOnly: Codable { - +public struct ArrayOfArrayOfNumberOnly: Codable { public var arrayArrayNumber: [[Double]]? @@ -17,7 +15,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable { self.arrayArrayNumber = arrayArrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayArrayNumber = "ArrayArrayNumber" } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index 6b8873730c43cabe3911148ca8edc15b468d0a17..e84eb5d650258b37fdd423fadcfe1c7fc63962df 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfNumberOnly: Codable { - +public struct ArrayOfNumberOnly: Codable { public var arrayNumber: [Double]? @@ -17,7 +15,7 @@ public struct ArrayOfNumberOnly: Codable { self.arrayNumber = arrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayNumber = "ArrayNumber" } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index 64f7c6d9db99f4927f985c425f33a0d435c7d701..d2140933d1817725be708b41da4e996a549f3896 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayTest: Codable { - +public struct ArrayTest: Codable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? @@ -21,7 +19,7 @@ public struct ArrayTest: Codable { self.arrayArrayOfModel = arrayArrayOfModel } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayOfString = "array_of_string" case arrayArrayOfInteger = "array_array_of_integer" case arrayArrayOfModel = "array_array_of_model" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index ddb669a590459e81909408e9d2d9bc40dadfd38e..d1b3b27616edc9a2da27adb54c6b95ce056f8e91 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Capitalization: Codable { - +public struct Capitalization: Codable { public var smallCamel: String? public var capitalCamel: String? @@ -28,7 +26,7 @@ public struct Capitalization: Codable { self.ATT_NAME = ATT_NAME } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case smallCamel case capitalCamel = "CapitalCamel" case smallSnake = "small_Snake" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index c4f6e0d488caad736393f8a8936e5db63fec5378..7ab887f3113f1dd39f42b1019d8f58d45325f288 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Cat: Codable { - +public struct Cat: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift index 7b1d7e32be80ed62c3c1dda290093a4ea02a6c7b..a51ad0dffab1ba129591056cd816575af0e1ea09 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct CatAllOf: Codable { - +public struct CatAllOf: Codable { public var declawed: Bool? diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 3ec00f5ab10d19c5cd961c6316c9ec7960a85c57..eb8f7e5e1974989058473e4492c25c0004f1078c 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Category: Codable { - +public struct Category: Codable { public var id: Int64? public var name: String = "default-name" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index af030c3dd6269b59f42af7280976d3fa9dee9425..e2a7d4427a061dd104df50c1922ab1446e549106 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Codable { - +public struct ClassModel: Codable { public var _class: String? diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index 0aae748c76b4398015bcac633f082d0fbd84531a..00245ca37280eea9c87184eb0f40fb8bf03b81f2 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Client: Codable { - +public struct Client: Codable { public var client: String? diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 198e28b94dd6615a5da1b5c9efd0e13c3150de4a..492c1228008eb782ea0f927f65259ce2c7999d24 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Dog: Codable { - +public struct Dog: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift index 8ff49b2af23fc129b73f3bfc3e4c8a6d95b16ea5..7786f8acc5ae7d0de7de7248ef5a94d4d16f0a17 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct DogAllOf: Codable { - +public struct DogAllOf: Codable { public var breed: String? diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index e2d3fa04f94b92473f218965cf21bb8eb8e82ee2..9844e7c40e35868546bb256fd806eb8b30b135f2 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumArrays: Codable { - +public struct EnumArrays: Codable { public enum JustSymbol: String, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -27,7 +25,7 @@ public struct EnumArrays: Codable { self.arrayEnum = arrayEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justSymbol = "just_symbol" case arrayEnum = "array_enum" } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift index c2c639ba3246c2c7d30830770fc80529114eca31..d4029d73f8aff2b20baf7856bb6517a1407731b5 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -7,7 +7,6 @@ import Foundation - public enum EnumClass: String, Codable, CaseIterable { case abc = "_abc" case efg = "-efg" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index a56e1f36389b91b5bf92522d6248b9fc69d3c386..789f583e1d778b6b26d6270fe386e3b88b406488 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumTest: Codable { - +public struct EnumTest: Codable { public enum EnumString: String, Codable, CaseIterable { case upper = "UPPER" @@ -43,7 +41,7 @@ public struct EnumTest: Codable { self.outerEnum = outerEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case enumString = "enum_string" case enumStringRequired = "enum_string_required" case enumInteger = "enum_integer" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift index 773b53b2cb765586e3a14e4034a7c8da7a177363..abf3ccffc48588b98475607b17878c7d03320f48 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,8 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Codable { - +public struct File: Codable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 83dc1148cfa3d6e9bbcb2d78f2d62b38045668b6..532f1457939af300b65f89821673cf1951ec2f0b 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FileSchemaTestClass: Codable { - +public struct FileSchemaTestClass: Codable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index bccd3f9fb1786b11e4d4dc8e97ca6bd3e73f4cab..20bd6d103b3dc87ffa6d7f38b21d957318628930 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FormatTest: Codable { - +public struct FormatTest: Codable { public var integer: Int? public var int32: Int? diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index 566d71a35ef0193c3e0ca140a6adabfcdc84588f..906ddb06fb170e5de30f07754fce3efc4f512ee1 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct HasOnlyReadOnly: Codable { - +public struct HasOnlyReadOnly: Codable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 80cecab242f25976c3ac5b7538ca07f7d1a1e1b8..fe13d302ccbfde321339be7d09f6932248c2570e 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,9 +7,7 @@ import Foundation - -public struct List: Codable { - +public struct List: Codable { public var _123list: String? @@ -17,7 +15,7 @@ public struct List: Codable { self._123list = _123list } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _123list = "123-list" } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index f0c02de95f7abe0f4bd7fac695d9c590120d8504..4b6037f378ee6b0152805f8b11d374a16373e222 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,27 +7,25 @@ import Foundation - -public struct MapTest: Codable { - +public struct MapTest: Codable { public enum MapOfEnumString: String, Codable, CaseIterable { case upper = "UPPER" case lower = "lower" } - public var mapMapOfString: [String:[String:String]]? - public var mapOfEnumString: [String:String]? - public var directMap: [String:Bool]? + public var mapMapOfString: [String: [String: String]]? + public var mapOfEnumString: [String: String]? + public var directMap: [String: Bool]? public var indirectMap: StringBooleanMap? - public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) { + public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { self.mapMapOfString = mapMapOfString self.mapOfEnumString = mapOfEnumString self.directMap = directMap self.indirectMap = indirectMap } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapMapOfString = "map_map_of_string" case mapOfEnumString = "map_of_enum_string" case directMap = "direct_map" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 710e62a9b5875c830a4885dac70b0bedb56d32b2..c3deb2f28932f5d0ab338f3da2ac398de24a8822 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,15 +7,13 @@ import Foundation - -public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { - +public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { public var uuid: UUID? public var dateTime: Date? - public var map: [String:Animal]? + public var map: [String: Animal]? - public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) { + public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { self.uuid = uuid self.dateTime = dateTime self.map = map diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index 450a53b918ca0d82e9697268575f6315bd76e1c7..b61db7d6e716185b1b6f21ac2c536f3d5e408809 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Codable { - +public struct Model200Response: Codable { public var name: Int? public var _class: String? @@ -19,7 +18,7 @@ public struct Model200Response: Codable { self._class = _class } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case _class = "class" } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index 6deb69fcd7313698cb05f790654c47f98a303665..8ab4db44b73a3726cc854651fef382bd9fcf69b6 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Codable { - +public struct Name: Codable { public var name: Int public var snakeCase: Int? @@ -23,7 +22,7 @@ public struct Name: Codable { self._123number = _123number } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case snakeCase = "snake_case" case property diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 0c9ee2b7b9f4a7fcd3a7c1ed1e142e8fcce4cf84..4d1dafcc2c1f56bf9c7e317734efc71ee9fbd09a 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct NumberOnly: Codable { - +public struct NumberOnly: Codable { public var justNumber: Double? @@ -17,7 +15,7 @@ public struct NumberOnly: Codable { self.justNumber = justNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justNumber = "JustNumber" } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index ab0eac0b304e4a248aa897d86579bde395947b77..40c30cc8609c33fd59240aae30ba7d942e4d3659 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Order: Codable { - +public struct Order: Codable { public enum Status: String, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 4a7d227104413d7065789fa87b4c2f41078130a0..18c3a024f1227af549fb1b13b1838f1e81a837b1 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,9 +7,7 @@ import Foundation - -public struct OuterComposite: Codable { - +public struct OuterComposite: Codable { public var myNumber: Double? public var myString: String? @@ -21,7 +19,7 @@ public struct OuterComposite: Codable { self.myBoolean = myBoolean } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case myNumber = "my_number" case myString = "my_string" case myBoolean = "my_boolean" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift index 9e6b8d74e874c1d75bf8afbb92296996e39cf366..c3b778cbbed444c54045dedb48213ce3bb532dbf 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -7,7 +7,6 @@ import Foundation - public enum OuterEnum: String, Codable, CaseIterable { case placed = "placed" case approved = "approved" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index a973071d6c9615c7e082183ec555eb794bb11b3b..b9ce0e933256c401ced1143aaa31936cf60bdb63 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Pet: Codable { - +public struct Pet: Codable { public enum Status: String, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index b2a6b7e2b8a61e14c75f22de2da766e96afc1fca..0acd21fd10000317ffc9f96840a49b3dd538d0c7 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ReadOnlyFirst: Codable { - +public struct ReadOnlyFirst: Codable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index 7e089dcee2b4a366353619ee201eb067bb63ed71..c223f993a69ece3abf5451c68d01eb666dad5b19 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Codable { - +public struct Return: Codable { public var _return: Int? @@ -17,7 +16,7 @@ public struct Return: Codable { self._return = _return } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _return = "return" } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index e890ef952520010cb37b71b4f4c06215b4f7c88c..6e8650f76d8ece4a8511cf0afacf62816e852598 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,9 +7,7 @@ import Foundation - -public struct SpecialModelName: Codable { - +public struct SpecialModelName: Codable { public var specialPropertyName: Int64? @@ -17,7 +15,7 @@ public struct SpecialModelName: Codable { self.specialPropertyName = specialPropertyName } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case specialPropertyName = "$special[property.name]" } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index f65ae0623d6e8567ed17f651d3c0ff056fefb1ba..3f1237fee477a298b1d99cef8062371e2f101f59 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,12 +7,9 @@ import Foundation +public struct StringBooleanMap: Codable { -public struct StringBooleanMap: Codable { - - - - public var additionalProperties: [String:Bool] = [:] + public var additionalProperties: [String: Bool] = [:] public subscript(key: String) -> Bool? { get { @@ -45,5 +42,4 @@ public struct StringBooleanMap: Codable { additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index a91b6061bcf78c8ad31d4ae87401afa4ac72330b..4dd8a9a9f5a0fc547c88401b39caf0f00cddd61d 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Tag: Codable { - +public struct Tag: Codable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index 2d377c3edb02c59cbf82ae4bc9534eba7c3f3e2b..a9e088808ed378dfa9690f8dfa1fc687294bd3bd 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderDefault: Codable { - +public struct TypeHolderDefault: Codable { public var stringItem: String = "what" public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderDefault: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index e5eb92da696e19c998edd122f874f9f7fa776148..dff4083ae43260c42e61413843b52749b26b6769 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderExample: Codable { - +public struct TypeHolderExample: Codable { public var stringItem: String public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderExample: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift index f70328ca9e597ffca3abc70b5340fda99848a4d1..79f271ed73564b8af07f2698e649f38062255ce7 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,9 +7,7 @@ import Foundation - -public struct User: Codable { - +public struct User: Codable { public var id: Int64? public var username: String? 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 22261e2ce9483f4ac59c12ff516a53863a606132..55d0eb42191942998769644daea74ffeb51cbcd7 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -14,7 +14,7 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { return URLSessionRequestBuilder<T>.self } - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type { + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { return URLSessionDecodableRequestBuilder<T>.self } } @@ -23,16 +23,16 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { private var urlSessionStore = SynchronizedDictionary<String, URLSession>() open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - + private var observation: NSKeyValueObservation? - + deinit { observation?.invalidate() } - + // swiftlint:disable:next weak_delegate fileprivate let sessionDelegate = SessionDelegate() - + /** May be assigned if you want to control the authentication challenges. */ @@ -45,11 +45,11 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - retry the request. */ public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? - - required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { + + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } - + /** May be overridden by a subclass if you want to control the URLSession configuration. @@ -77,40 +77,40 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { May be overridden by a subclass if you want to control the URLRequest configuration (e.g. to override the cache policy). */ - open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) throws -> URLRequest { - + open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { + guard let url = URL(string: URLString) else { throw DownloadException.requestMissingURL } - + var originalRequest = URLRequest(url: url) - + originalRequest.httpMethod = method.rawValue - + buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + headers.forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) - + return modifiedRequest } override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { - let urlSessionId:String = UUID().uuidString + let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() urlSessionStore[urlSessionId] = urlSession - + let parameters: [String: Any] = self.parameters ?? [:] - + let fileKeys = parameters.filter { $1 is URL } .map { $0.0 } - + let encoding: ParameterEncoding if fileKeys.count > 0 { encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) @@ -119,29 +119,29 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } else { encoding = URLEncoding() } - + guard let xMethod = HTTPMethod(rawValue: method) else { fatalError("Unsuported Http method - \(method)") } - + let cleanupRequest = { urlSessionStore[urlSessionId] = nil self.observation?.invalidate() } - + do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - + let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - + guard let self = self else { return } - + if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - + taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - + guard let self = self else { return } - + if shouldRetry { cleanupRequest() self.execute(apiResponseQueue, completion) @@ -157,13 +157,13 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } } - + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { onProgressReady?(dataTask.progress) } - + dataTask.resume() - + } catch { apiResponseQueue.async { cleanupRequest() @@ -172,7 +172,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } - + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -192,52 +192,52 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is URL.Type: do { - + guard error == nil else { throw DownloadException.responseFailed } - + guard let data = data else { throw DownloadException.responseDataMissing } - + let fileManager = FileManager.default let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] let requestURL = try self.getURL(from: urlRequest) - + var requestPath = try self.getPath(from: requestURL) - + if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { requestPath = requestPath.appending("/\(headerFileName)") } - + let filePath = documentsDirectory.appendingPathComponent(requestPath) let directoryPath = filePath.deletingLastPathComponent().path - + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) - + completion(.success(Response(response: httpResponse, body: filePath as? T))) - + } catch let requestParserError as DownloadException { completion(.failure(ErrorResponse.error(400, data, requestParserError))) } catch let error { completion(.failure(ErrorResponse.error(400, data, error))) } - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + default: - + completion(.success(Response(response: httpResponse, body: data as? T))) } @@ -251,7 +251,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { guard let contentDisposition = contentDisposition else { return nil @@ -270,7 +270,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { filename = contentItem return filename? - .replacingCharacters(in: range, with:"") + .replacingCharacters(in: range, with: "") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } @@ -279,7 +279,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getPath(from url : URL) throws -> String { + fileprivate func getPath(from url: URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath @@ -293,7 +293,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL @@ -304,7 +304,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } -open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuilder<T> { +open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -324,28 +324,28 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + case is Data.Type: - + completion(.success(Response(response: httpResponse, body: data as? T))) - + default: - + guard let data = data, !data.isEmpty else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse))) return } - + let decodeResult = CodableHelper.decode(T.self, from: data) - + switch decodeResult { case let .success(decodableObj): completion(.success(Response(response: httpResponse, body: decodableObj))) @@ -356,10 +356,10 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil } } -fileprivate class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { - +private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { + var credential: URLCredential? - + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { @@ -402,13 +402,13 @@ public protocol ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest } -fileprivate class URLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) throws -> URLRequest { - +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - + guard let parameters = parameters else { return urlRequest } - + guard let url = urlRequest.url else { throw DownloadException.requestMissingURL } @@ -417,12 +417,12 @@ fileprivate class URLEncoding: ParameterEncoding { urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) urlRequest.url = urlComponents.url } - + return urlRequest } } -fileprivate class FileUploadEncoding: ParameterEncoding { +private class FileUploadEncoding: ParameterEncoding { let contentTypeForFormPart: (_ fileURL: URL) -> String? @@ -433,13 +433,13 @@ fileprivate class FileUploadEncoding: ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { var urlRequest = urlRequest - + guard let parameters = parameters, !parameters.isEmpty else { return urlRequest } - + let boundary = "Boundary-\(UUID().uuidString)" - + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") for (key, value) in parameters { @@ -479,7 +479,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { fatalError("Unprocessable value \(value) with key \(key)") } } - + var body = urlRequest.httpBody.orEmpty body.append("\r\n--\(boundary)--\r\n") @@ -494,7 +494,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { var urlRequest = urlRequest var body = urlRequest.httpBody.orEmpty - + let fileData = try Data(contentsOf: fileURL) let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) @@ -502,7 +502,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } @@ -518,20 +518,20 @@ fileprivate class FileUploadEncoding: ParameterEncoding { // The value data. body.append(fileData) - + urlRequest.httpBody = body return urlRequest } - + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { var urlRequest = urlRequest - + var body = urlRequest.httpBody.orEmpty // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/Package.swift b/samples/client/petstore/swift5/rxswiftLibrary/Package.swift index 4b20458197f32a2abcbf468db221189e581b19b3..24f9a6c99ae59f7739c4bfeb5938654152cf3b7e 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/Package.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/Package.swift @@ -14,11 +14,11 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "PetstoreClient", - targets: ["PetstoreClient"]), + targets: ["PetstoreClient"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/ReactiveX/RxSwift.git", from: "5.0.0"), + .package(url: "https://github.com/ReactiveX/RxSwift.git", from: "5.0.0") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. @@ -27,6 +27,6 @@ let package = Package( name: "PetstoreClient", dependencies: ["RxSwift"], path: "PetstoreClient/Classes" - ), + ) ] ) diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 2404bc8ffc6d6a190b82327193d4b5b2325dd515..5b09f9557113d4bc4d0ca8b0b05b4f408008c2ff 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,7 +7,7 @@ import Foundation public struct APIHelper { - public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,17 +20,17 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? Array<Any?> { - result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" } } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { guard let source = source else { return nil } @@ -46,15 +46,15 @@ public struct APIHelper { } public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? Array<Any?> { + if let collection = source as? [Any?] { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? Array<Any?> { + if let collection = item.value as? [Any?] { collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in result.append(URLQueryItem(name: item.key, value: value)) } @@ -69,4 +69,3 @@ public struct APIHelper { return destination } } - diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index c5d1b9b42df33641cc1c81227a5027da0da95336..a5c2d605dff6f91df4130c2ff02d09919bae6974 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,15 +9,15 @@ import Foundation open class PetstoreClientAPI { public static var basePath = "http://petstore.swagger.io:80/v2" public static var credential: URLCredential? - public static var customHeaders: [String:String] = [:] + public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder<T> { var credential: URLCredential? - var headers: [String:String] - public let parameters: [String:Any]? + var headers: [String: String] + public let parameters: [String: Any]? public let isBody: Bool public let method: String public let URLString: String @@ -25,9 +25,9 @@ open class RequestBuilder<T> { /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. /// If you need to get the request's progress in older OS versions, please use Alamofire http client. - public var onProgressReady: ((Progress) -> ())? + public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -37,7 +37,7 @@ open class RequestBuilder<T> { addHeaders(PetstoreClientAPI.customHeaders) } - open func addHeaders(_ aHeaders:[String:String]) { + open func addHeaders(_ aHeaders: [String: String]) { for (header, value) in aHeaders { headers[header] = value } @@ -60,5 +60,5 @@ open class RequestBuilder<T> { public protocol RequestBuilderFactory { func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 4090e37b32c9465a17d0d65daa59af78923c097f..792371b384219f3d69f3c2f90f084aee977ec0a1 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -8,8 +8,6 @@ import Foundation import RxSwift - - open class AnotherFakeAPI { /** To test special tags diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index fa3d09834ff0bbe2714fc9454b0f1427b7af128a..3e9b32438c825447a8d9d2dc639ca0a0320733ac 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -8,8 +8,6 @@ import Foundation import RxSwift - - open class FakeAPI { /** @@ -351,7 +349,7 @@ open class FakeAPI { open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), @@ -370,7 +368,7 @@ open class FakeAPI { let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -491,19 +489,19 @@ open class FakeAPI { open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "enum_form_string_array": enumFormStringArray?.encodeToJSON(), "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), - "enum_query_string": enumQueryString?.encodeToJSON(), - "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -559,13 +557,13 @@ open class FakeAPI { open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": requiredStringGroup.encodeToJSON(), - "required_int64_group": requiredInt64Group.encodeToJSON(), - "string_group": stringGroup?.encodeToJSON(), + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -586,7 +584,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Observable<Void> */ - open class func testInlineAdditionalProperties(param: [String:String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable<Void> { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable<Void> { return Observable.create { observer -> Disposable in testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in switch result { @@ -607,7 +605,7 @@ open class FakeAPI { - parameter param: (body) request body - returns: RequestBuilder<Void> */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> { let path = "/fake/inline-additionalProperties" let URLString = PetstoreClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) @@ -652,14 +650,14 @@ open class FakeAPI { open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "param": param.encodeToJSON(), "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 1353f91b278fcd1a51aab5a443936dfd6f6d3e1e..989a914f3795e941d0ffb8647c978c3d4cfee044 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -8,8 +8,6 @@ import Foundation import RxSwift - - open class FakeClassnameTags123API { /** To test class name in snake case diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 41cb591c8955caf0bc04784b816f99596ef6fcbd..b3a26902360ed6a77294beff7b22a802a878bd52 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -8,8 +8,6 @@ import Foundation import RxSwift - - open class PetAPI { /** Add a new pet to the store @@ -93,8 +91,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ "api_key": apiKey?.encodeToJSON() @@ -150,8 +148,8 @@ open class PetAPI { open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "status": status.encodeToJSON() @@ -199,8 +197,8 @@ open class PetAPI { open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "tags": tags.encodeToJSON() @@ -249,8 +247,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -342,14 +340,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "name": name?.encodeToJSON(), "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -398,14 +396,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -454,14 +452,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index f5c974ba382419a500ce9af108a15462831404bf..dea3933433cf1f668813bfe41261e82828aaefb9 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -8,8 +8,6 @@ import Foundation import RxSwift - - open class StoreAPI { /** Delete purchase order by ID @@ -46,8 +44,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -61,7 +59,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - returns: Observable<[String:Int]> */ - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable<[String:Int]> { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable<[String: Int]> { return Observable.create { observer -> Disposable in getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { @@ -85,14 +83,14 @@ open class StoreAPI { - name: api_key - returns: RequestBuilder<[String:Int]> */ - open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { let path = "/store/inventory" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } @@ -132,8 +130,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 2228363cfccd785146df1a9da956770a133c29b1..3447ea28c0ed2a64ccbd19e5f8c6353a485cd4a4 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -8,8 +8,6 @@ import Foundation import RxSwift - - open class UserAPI { /** Create user @@ -167,8 +165,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -210,8 +208,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -253,11 +251,11 @@ open class UserAPI { open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username.encodeToJSON(), + "username": username.encodeToJSON(), "password": password.encodeToJSON() ]) @@ -295,8 +293,8 @@ open class UserAPI { open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 01b28a4bd42d21245b26f53ba2766a44c3ff0d38..ef971ebadc60ae1d358d9d87e8727aa13ec7437b 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -45,4 +45,4 @@ open class CodableHelper { open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { return Swift.Result { try self.jsonEncoder.encode(value) } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift index f171525e43944f9cedf0e5146a39752fc2e848dc..627d9adb757ef30f3bf44723748aee6b5f1913d9 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,10 +7,10 @@ import Foundation open class Configuration { - + // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} \ No newline at end of file + +} 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 6e279679c67a1e7e3f302fc0fcbfd5b58a6dd12f..93ed6b90b376a7b84e9eabb1705f3dcb8bd98a14 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -108,24 +108,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { if let values = values { try encodeArray(values, forKey: key) } } - public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable { + public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable { + public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { - var tmpArray: [T]? = nil + public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? if contains(key) { tmpArray = try decodeArray(T.self, forKey: key) @@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable { - var map: [Self.Key : T] = [:] + public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -177,5 +177,3 @@ extension HTTPURLResponse { return Array(200 ..< 300).contains(statusCode) } } - - diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift index 08f1ef334dff10656c28e298c6b9b6d754159d73..b79e9f5e64d518e51552c62467884931ee1eaf3c 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -41,7 +41,7 @@ public struct JSONDataEncoding { } public static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? = nil + var returnedParams: [String: Any]? if let jsonData = jsonData, !jsonData.isEmpty { var params: [String: Any] = [:] params[jsonDataKey] = jsonData diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 314f1eff1f9b07d17db1930bfbe566baedbbc5cc..02f78ffb47056ddebac110679c4b545ed2861125 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -9,8 +9,8 @@ import Foundation open class JSONEncodingHelper { - open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? = nil + open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? // Encode the Encodable object if let encodableObj = encodableObj { @@ -27,7 +27,7 @@ open class JSONEncodingHelper { } open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? = nil + var params: [String: Any]? if let encodableObj = encodableObj { do { @@ -41,5 +41,5 @@ open class JSONEncodingHelper { return params } - + } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift index 11e81ffcc472bbe9ca94aecdf5b731470979d0de..c0542c14c0812d73834b48ba2123704b096bd61c 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,11 +10,11 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse : Error { +public enum ErrorResponse: Error { case error(Int, Data?, Error) } -public enum DownloadException : Error { +public enum DownloadException: Error { case responseDataMissing case responseFailed case requestMissing @@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error { case generalError(Error) } - open class Response<T> { public let statusCode: Int public let header: [String: String] @@ -44,7 +43,7 @@ open class Response<T> { public convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String:String]() + var header = [String: String]() for (key, value) in rawHeader { if let key = key.base as? String, let value = value as? String { header[key] = value diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 28ca8377b889b8436d0d11797c89daaa27864e9f..1af0315359678116da5f18a94457d0d2a1178e51 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,19 +7,17 @@ import Foundation +public struct AdditionalPropertiesClass: Codable { -public struct AdditionalPropertiesClass: Codable { + public var mapString: [String: String]? + public var mapMapString: [String: [String: String]]? - - public var mapString: [String:String]? - public var mapMapString: [String:[String:String]]? - - public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { + public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { self.mapString = mapString self.mapMapString = mapMapString } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapString = "map_string" case mapMapString = "map_map_string" } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index 1050d79dbe9df42e68f40f036c83f858d3cfd441..5ed9f31e2a364d0bf7a25bdf70cecb48af6ab5c4 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Animal: Codable { - +public struct Animal: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift index e7bea63f8ed28132865ea4d3c23eab55666cf4f6..e09b0e9efdc8ca7798114f24aff21f57e8f9fabd 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -7,5 +7,4 @@ import Foundation - public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index 4d0393b9ba45fb26499017214280bf04637ebe09..ec270da8907438877ee5cc303b093ceba3993297 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ApiResponse: Codable { - +public struct ApiResponse: Codable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 1363c96394baf0514e28045c00399b49591a962d..6c252ed475b2ed17ed9cd5a9eee4db0348886338 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfArrayOfNumberOnly: Codable { - +public struct ArrayOfArrayOfNumberOnly: Codable { public var arrayArrayNumber: [[Double]]? @@ -17,7 +15,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable { self.arrayArrayNumber = arrayArrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayArrayNumber = "ArrayArrayNumber" } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index 6b8873730c43cabe3911148ca8edc15b468d0a17..e84eb5d650258b37fdd423fadcfe1c7fc63962df 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfNumberOnly: Codable { - +public struct ArrayOfNumberOnly: Codable { public var arrayNumber: [Double]? @@ -17,7 +15,7 @@ public struct ArrayOfNumberOnly: Codable { self.arrayNumber = arrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayNumber = "ArrayNumber" } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index 64f7c6d9db99f4927f985c425f33a0d435c7d701..d2140933d1817725be708b41da4e996a549f3896 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayTest: Codable { - +public struct ArrayTest: Codable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? @@ -21,7 +19,7 @@ public struct ArrayTest: Codable { self.arrayArrayOfModel = arrayArrayOfModel } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayOfString = "array_of_string" case arrayArrayOfInteger = "array_array_of_integer" case arrayArrayOfModel = "array_array_of_model" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index ddb669a590459e81909408e9d2d9bc40dadfd38e..d1b3b27616edc9a2da27adb54c6b95ce056f8e91 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Capitalization: Codable { - +public struct Capitalization: Codable { public var smallCamel: String? public var capitalCamel: String? @@ -28,7 +26,7 @@ public struct Capitalization: Codable { self.ATT_NAME = ATT_NAME } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case smallCamel case capitalCamel = "CapitalCamel" case smallSnake = "small_Snake" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index c4f6e0d488caad736393f8a8936e5db63fec5378..7ab887f3113f1dd39f42b1019d8f58d45325f288 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Cat: Codable { - +public struct Cat: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift index 7b1d7e32be80ed62c3c1dda290093a4ea02a6c7b..a51ad0dffab1ba129591056cd816575af0e1ea09 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct CatAllOf: Codable { - +public struct CatAllOf: Codable { public var declawed: Bool? diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 3ec00f5ab10d19c5cd961c6316c9ec7960a85c57..eb8f7e5e1974989058473e4492c25c0004f1078c 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Category: Codable { - +public struct Category: Codable { public var id: Int64? public var name: String = "default-name" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index af030c3dd6269b59f42af7280976d3fa9dee9425..e2a7d4427a061dd104df50c1922ab1446e549106 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Codable { - +public struct ClassModel: Codable { public var _class: String? diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index 0aae748c76b4398015bcac633f082d0fbd84531a..00245ca37280eea9c87184eb0f40fb8bf03b81f2 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Client: Codable { - +public struct Client: Codable { public var client: String? diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 198e28b94dd6615a5da1b5c9efd0e13c3150de4a..492c1228008eb782ea0f927f65259ce2c7999d24 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Dog: Codable { - +public struct Dog: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift index 8ff49b2af23fc129b73f3bfc3e4c8a6d95b16ea5..7786f8acc5ae7d0de7de7248ef5a94d4d16f0a17 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct DogAllOf: Codable { - +public struct DogAllOf: Codable { public var breed: String? diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index e2d3fa04f94b92473f218965cf21bb8eb8e82ee2..9844e7c40e35868546bb256fd806eb8b30b135f2 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumArrays: Codable { - +public struct EnumArrays: Codable { public enum JustSymbol: String, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -27,7 +25,7 @@ public struct EnumArrays: Codable { self.arrayEnum = arrayEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justSymbol = "just_symbol" case arrayEnum = "array_enum" } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift index c2c639ba3246c2c7d30830770fc80529114eca31..d4029d73f8aff2b20baf7856bb6517a1407731b5 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -7,7 +7,6 @@ import Foundation - public enum EnumClass: String, Codable, CaseIterable { case abc = "_abc" case efg = "-efg" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index a56e1f36389b91b5bf92522d6248b9fc69d3c386..789f583e1d778b6b26d6270fe386e3b88b406488 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumTest: Codable { - +public struct EnumTest: Codable { public enum EnumString: String, Codable, CaseIterable { case upper = "UPPER" @@ -43,7 +41,7 @@ public struct EnumTest: Codable { self.outerEnum = outerEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case enumString = "enum_string" case enumStringRequired = "enum_string_required" case enumInteger = "enum_integer" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift index 773b53b2cb765586e3a14e4034a7c8da7a177363..abf3ccffc48588b98475607b17878c7d03320f48 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,8 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Codable { - +public struct File: Codable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 83dc1148cfa3d6e9bbcb2d78f2d62b38045668b6..532f1457939af300b65f89821673cf1951ec2f0b 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FileSchemaTestClass: Codable { - +public struct FileSchemaTestClass: Codable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index bccd3f9fb1786b11e4d4dc8e97ca6bd3e73f4cab..20bd6d103b3dc87ffa6d7f38b21d957318628930 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FormatTest: Codable { - +public struct FormatTest: Codable { public var integer: Int? public var int32: Int? diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index 566d71a35ef0193c3e0ca140a6adabfcdc84588f..906ddb06fb170e5de30f07754fce3efc4f512ee1 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct HasOnlyReadOnly: Codable { - +public struct HasOnlyReadOnly: Codable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 80cecab242f25976c3ac5b7538ca07f7d1a1e1b8..fe13d302ccbfde321339be7d09f6932248c2570e 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,9 +7,7 @@ import Foundation - -public struct List: Codable { - +public struct List: Codable { public var _123list: String? @@ -17,7 +15,7 @@ public struct List: Codable { self._123list = _123list } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _123list = "123-list" } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index f0c02de95f7abe0f4bd7fac695d9c590120d8504..4b6037f378ee6b0152805f8b11d374a16373e222 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,27 +7,25 @@ import Foundation - -public struct MapTest: Codable { - +public struct MapTest: Codable { public enum MapOfEnumString: String, Codable, CaseIterable { case upper = "UPPER" case lower = "lower" } - public var mapMapOfString: [String:[String:String]]? - public var mapOfEnumString: [String:String]? - public var directMap: [String:Bool]? + public var mapMapOfString: [String: [String: String]]? + public var mapOfEnumString: [String: String]? + public var directMap: [String: Bool]? public var indirectMap: StringBooleanMap? - public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) { + public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { self.mapMapOfString = mapMapOfString self.mapOfEnumString = mapOfEnumString self.directMap = directMap self.indirectMap = indirectMap } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapMapOfString = "map_map_of_string" case mapOfEnumString = "map_of_enum_string" case directMap = "direct_map" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 710e62a9b5875c830a4885dac70b0bedb56d32b2..c3deb2f28932f5d0ab338f3da2ac398de24a8822 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,15 +7,13 @@ import Foundation - -public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { - +public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { public var uuid: UUID? public var dateTime: Date? - public var map: [String:Animal]? + public var map: [String: Animal]? - public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) { + public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { self.uuid = uuid self.dateTime = dateTime self.map = map diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index 450a53b918ca0d82e9697268575f6315bd76e1c7..b61db7d6e716185b1b6f21ac2c536f3d5e408809 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Codable { - +public struct Model200Response: Codable { public var name: Int? public var _class: String? @@ -19,7 +18,7 @@ public struct Model200Response: Codable { self._class = _class } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case _class = "class" } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index 6deb69fcd7313698cb05f790654c47f98a303665..8ab4db44b73a3726cc854651fef382bd9fcf69b6 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Codable { - +public struct Name: Codable { public var name: Int public var snakeCase: Int? @@ -23,7 +22,7 @@ public struct Name: Codable { self._123number = _123number } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case snakeCase = "snake_case" case property diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 0c9ee2b7b9f4a7fcd3a7c1ed1e142e8fcce4cf84..4d1dafcc2c1f56bf9c7e317734efc71ee9fbd09a 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct NumberOnly: Codable { - +public struct NumberOnly: Codable { public var justNumber: Double? @@ -17,7 +15,7 @@ public struct NumberOnly: Codable { self.justNumber = justNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justNumber = "JustNumber" } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index ab0eac0b304e4a248aa897d86579bde395947b77..40c30cc8609c33fd59240aae30ba7d942e4d3659 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Order: Codable { - +public struct Order: Codable { public enum Status: String, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 4a7d227104413d7065789fa87b4c2f41078130a0..18c3a024f1227af549fb1b13b1838f1e81a837b1 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,9 +7,7 @@ import Foundation - -public struct OuterComposite: Codable { - +public struct OuterComposite: Codable { public var myNumber: Double? public var myString: String? @@ -21,7 +19,7 @@ public struct OuterComposite: Codable { self.myBoolean = myBoolean } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case myNumber = "my_number" case myString = "my_string" case myBoolean = "my_boolean" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift index 9e6b8d74e874c1d75bf8afbb92296996e39cf366..c3b778cbbed444c54045dedb48213ce3bb532dbf 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -7,7 +7,6 @@ import Foundation - public enum OuterEnum: String, Codable, CaseIterable { case placed = "placed" case approved = "approved" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index a973071d6c9615c7e082183ec555eb794bb11b3b..b9ce0e933256c401ced1143aaa31936cf60bdb63 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Pet: Codable { - +public struct Pet: Codable { public enum Status: String, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index b2a6b7e2b8a61e14c75f22de2da766e96afc1fca..0acd21fd10000317ffc9f96840a49b3dd538d0c7 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ReadOnlyFirst: Codable { - +public struct ReadOnlyFirst: Codable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index 7e089dcee2b4a366353619ee201eb067bb63ed71..c223f993a69ece3abf5451c68d01eb666dad5b19 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Codable { - +public struct Return: Codable { public var _return: Int? @@ -17,7 +16,7 @@ public struct Return: Codable { self._return = _return } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _return = "return" } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index e890ef952520010cb37b71b4f4c06215b4f7c88c..6e8650f76d8ece4a8511cf0afacf62816e852598 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,9 +7,7 @@ import Foundation - -public struct SpecialModelName: Codable { - +public struct SpecialModelName: Codable { public var specialPropertyName: Int64? @@ -17,7 +15,7 @@ public struct SpecialModelName: Codable { self.specialPropertyName = specialPropertyName } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case specialPropertyName = "$special[property.name]" } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index f65ae0623d6e8567ed17f651d3c0ff056fefb1ba..3f1237fee477a298b1d99cef8062371e2f101f59 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,12 +7,9 @@ import Foundation +public struct StringBooleanMap: Codable { -public struct StringBooleanMap: Codable { - - - - public var additionalProperties: [String:Bool] = [:] + public var additionalProperties: [String: Bool] = [:] public subscript(key: String) -> Bool? { get { @@ -45,5 +42,4 @@ public struct StringBooleanMap: Codable { additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index a91b6061bcf78c8ad31d4ae87401afa4ac72330b..4dd8a9a9f5a0fc547c88401b39caf0f00cddd61d 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Tag: Codable { - +public struct Tag: Codable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index 2d377c3edb02c59cbf82ae4bc9534eba7c3f3e2b..a9e088808ed378dfa9690f8dfa1fc687294bd3bd 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderDefault: Codable { - +public struct TypeHolderDefault: Codable { public var stringItem: String = "what" public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderDefault: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index e5eb92da696e19c998edd122f874f9f7fa776148..dff4083ae43260c42e61413843b52749b26b6769 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderExample: Codable { - +public struct TypeHolderExample: Codable { public var stringItem: String public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderExample: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift index f70328ca9e597ffca3abc70b5340fda99848a4d1..79f271ed73564b8af07f2698e649f38062255ce7 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,9 +7,7 @@ import Foundation - -public struct User: Codable { - +public struct User: Codable { public var id: Int64? public var username: String? 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 22261e2ce9483f4ac59c12ff516a53863a606132..55d0eb42191942998769644daea74ffeb51cbcd7 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -14,7 +14,7 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { return URLSessionRequestBuilder<T>.self } - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type { + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { return URLSessionDecodableRequestBuilder<T>.self } } @@ -23,16 +23,16 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { private var urlSessionStore = SynchronizedDictionary<String, URLSession>() open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - + private var observation: NSKeyValueObservation? - + deinit { observation?.invalidate() } - + // swiftlint:disable:next weak_delegate fileprivate let sessionDelegate = SessionDelegate() - + /** May be assigned if you want to control the authentication challenges. */ @@ -45,11 +45,11 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - retry the request. */ public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? - - required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { + + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } - + /** May be overridden by a subclass if you want to control the URLSession configuration. @@ -77,40 +77,40 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { May be overridden by a subclass if you want to control the URLRequest configuration (e.g. to override the cache policy). */ - open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) throws -> URLRequest { - + open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { + guard let url = URL(string: URLString) else { throw DownloadException.requestMissingURL } - + var originalRequest = URLRequest(url: url) - + originalRequest.httpMethod = method.rawValue - + buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + headers.forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) - + return modifiedRequest } override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { - let urlSessionId:String = UUID().uuidString + let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() urlSessionStore[urlSessionId] = urlSession - + let parameters: [String: Any] = self.parameters ?? [:] - + let fileKeys = parameters.filter { $1 is URL } .map { $0.0 } - + let encoding: ParameterEncoding if fileKeys.count > 0 { encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) @@ -119,29 +119,29 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } else { encoding = URLEncoding() } - + guard let xMethod = HTTPMethod(rawValue: method) else { fatalError("Unsuported Http method - \(method)") } - + let cleanupRequest = { urlSessionStore[urlSessionId] = nil self.observation?.invalidate() } - + do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - + let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - + guard let self = self else { return } - + if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - + taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - + guard let self = self else { return } - + if shouldRetry { cleanupRequest() self.execute(apiResponseQueue, completion) @@ -157,13 +157,13 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } } - + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { onProgressReady?(dataTask.progress) } - + dataTask.resume() - + } catch { apiResponseQueue.async { cleanupRequest() @@ -172,7 +172,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } - + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -192,52 +192,52 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is URL.Type: do { - + guard error == nil else { throw DownloadException.responseFailed } - + guard let data = data else { throw DownloadException.responseDataMissing } - + let fileManager = FileManager.default let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] let requestURL = try self.getURL(from: urlRequest) - + var requestPath = try self.getPath(from: requestURL) - + if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { requestPath = requestPath.appending("/\(headerFileName)") } - + let filePath = documentsDirectory.appendingPathComponent(requestPath) let directoryPath = filePath.deletingLastPathComponent().path - + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) - + completion(.success(Response(response: httpResponse, body: filePath as? T))) - + } catch let requestParserError as DownloadException { completion(.failure(ErrorResponse.error(400, data, requestParserError))) } catch let error { completion(.failure(ErrorResponse.error(400, data, error))) } - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + default: - + completion(.success(Response(response: httpResponse, body: data as? T))) } @@ -251,7 +251,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { guard let contentDisposition = contentDisposition else { return nil @@ -270,7 +270,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { filename = contentItem return filename? - .replacingCharacters(in: range, with:"") + .replacingCharacters(in: range, with: "") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } @@ -279,7 +279,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getPath(from url : URL) throws -> String { + fileprivate func getPath(from url: URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath @@ -293,7 +293,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL @@ -304,7 +304,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } -open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuilder<T> { +open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -324,28 +324,28 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + case is Data.Type: - + completion(.success(Response(response: httpResponse, body: data as? T))) - + default: - + guard let data = data, !data.isEmpty else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse))) return } - + let decodeResult = CodableHelper.decode(T.self, from: data) - + switch decodeResult { case let .success(decodableObj): completion(.success(Response(response: httpResponse, body: decodableObj))) @@ -356,10 +356,10 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil } } -fileprivate class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { - +private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { + var credential: URLCredential? - + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { @@ -402,13 +402,13 @@ public protocol ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest } -fileprivate class URLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) throws -> URLRequest { - +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - + guard let parameters = parameters else { return urlRequest } - + guard let url = urlRequest.url else { throw DownloadException.requestMissingURL } @@ -417,12 +417,12 @@ fileprivate class URLEncoding: ParameterEncoding { urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) urlRequest.url = urlComponents.url } - + return urlRequest } } -fileprivate class FileUploadEncoding: ParameterEncoding { +private class FileUploadEncoding: ParameterEncoding { let contentTypeForFormPart: (_ fileURL: URL) -> String? @@ -433,13 +433,13 @@ fileprivate class FileUploadEncoding: ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { var urlRequest = urlRequest - + guard let parameters = parameters, !parameters.isEmpty else { return urlRequest } - + let boundary = "Boundary-\(UUID().uuidString)" - + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") for (key, value) in parameters { @@ -479,7 +479,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { fatalError("Unprocessable value \(value) with key \(key)") } } - + var body = urlRequest.httpBody.orEmpty body.append("\r\n--\(boundary)--\r\n") @@ -494,7 +494,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { var urlRequest = urlRequest var body = urlRequest.httpBody.orEmpty - + let fileData = try Data(contentsOf: fileURL) let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) @@ -502,7 +502,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } @@ -518,20 +518,20 @@ fileprivate class FileUploadEncoding: ParameterEncoding { // The value data. body.append(fileData) - + urlRequest.httpBody = body return urlRequest } - + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { var urlRequest = urlRequest - + var body = urlRequest.httpBody.orEmpty // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Package.swift b/samples/client/petstore/swift5/urlsessionLibrary/Package.swift index 79f6f81887383d4539292942c364aed2cfcfb5c6..96dfff54edf415c3c22de54b2758012c629b6f79 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Package.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Package.swift @@ -14,7 +14,7 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "PetstoreClient", - targets: ["PetstoreClient"]), + targets: ["PetstoreClient"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -26,6 +26,6 @@ let package = Package( name: "PetstoreClient", dependencies: [], path: "PetstoreClient/Classes" - ), + ) ] ) diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 2404bc8ffc6d6a190b82327193d4b5b2325dd515..5b09f9557113d4bc4d0ca8b0b05b4f408008c2ff 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,7 +7,7 @@ import Foundation public struct APIHelper { - public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,17 +20,17 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? Array<Any?> { - result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" } } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { guard let source = source else { return nil } @@ -46,15 +46,15 @@ public struct APIHelper { } public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? Array<Any?> { + if let collection = source as? [Any?] { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? Array<Any?> { + if let collection = item.value as? [Any?] { collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in result.append(URLQueryItem(name: item.key, value: value)) } @@ -69,4 +69,3 @@ public struct APIHelper { return destination } } - diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index c5d1b9b42df33641cc1c81227a5027da0da95336..a5c2d605dff6f91df4130c2ff02d09919bae6974 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,15 +9,15 @@ import Foundation open class PetstoreClientAPI { public static var basePath = "http://petstore.swagger.io:80/v2" public static var credential: URLCredential? - public static var customHeaders: [String:String] = [:] + public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder<T> { var credential: URLCredential? - var headers: [String:String] - public let parameters: [String:Any]? + var headers: [String: String] + public let parameters: [String: Any]? public let isBody: Bool public let method: String public let URLString: String @@ -25,9 +25,9 @@ open class RequestBuilder<T> { /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. /// If you need to get the request's progress in older OS versions, please use Alamofire http client. - public var onProgressReady: ((Progress) -> ())? + public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -37,7 +37,7 @@ open class RequestBuilder<T> { addHeaders(PetstoreClientAPI.customHeaders) } - open func addHeaders(_ aHeaders:[String:String]) { + open func addHeaders(_ aHeaders: [String: String]) { for (header, value) in aHeaders { headers[header] = value } @@ -60,5 +60,5 @@ open class RequestBuilder<T> { public protocol RequestBuilderFactory { func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index bb3ae717825412b9adeed7bb5ddda32ea74185ec..5bbf323f820cd3132cf60e1d11dbf21e55944156 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class AnotherFakeAPI { /** To test special tags @@ -17,7 +15,7 @@ open class AnotherFakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index d1d81faa335c4ea18856b16a52b2ee7cc0054f3a..134d6aea416a97039b668ee963e2c53f0df2d6d3 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class FakeAPI { /** @@ -16,7 +14,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?,_ error: Error?) -> Void)) { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) { fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -51,7 +49,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) { fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -86,7 +84,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?,_ error: Error?) -> Void)) { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) { fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -121,7 +119,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -156,7 +154,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -192,7 +190,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -231,7 +229,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -281,7 +279,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -318,7 +316,7 @@ open class FakeAPI { open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), @@ -337,7 +335,7 @@ open class FakeAPI { let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -426,7 +424,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -454,19 +452,19 @@ open class FakeAPI { open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "enum_form_string_array": enumFormStringArray?.encodeToJSON(), "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), - "enum_query_string": enumQueryString?.encodeToJSON(), - "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -492,7 +490,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -518,13 +516,13 @@ open class FakeAPI { open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": requiredStringGroup.encodeToJSON(), - "required_int64_group": requiredInt64Group.encodeToJSON(), - "string_group": stringGroup?.encodeToJSON(), + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -545,7 +543,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testInlineAdditionalProperties(param: [String:String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -562,7 +560,7 @@ open class FakeAPI { - parameter param: (body) request body - returns: RequestBuilder<Void> */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> { let path = "/fake/inline-additionalProperties" let URLString = PetstoreClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) @@ -582,7 +580,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -603,14 +601,14 @@ open class FakeAPI { open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "param": param.encodeToJSON(), "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index d21c4a49d43d099eaa7ffc901ca9ff1884235915..48cfe7187b9a6740385db65efbbdef7fb6164a7f 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -7,8 +7,6 @@ import Foundation - - open class FakeClassnameTags123API { /** To test class name in snake case @@ -17,7 +15,7 @@ open class FakeClassnameTags123API { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index f5366f5832baf471018f15f4d04882347e77df85..c938db7200472ab06b8c2f0a29c7660aec7cb118 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class PetAPI { /** Add a new pet to the store @@ -17,7 +15,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -57,7 +55,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -84,8 +82,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ "api_key": apiKey?.encodeToJSON() @@ -113,7 +111,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -137,8 +135,8 @@ open class PetAPI { open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "status": status.encodeToJSON() @@ -157,7 +155,7 @@ open class PetAPI { - parameter completion: completion handler to receive the data and the error objects */ @available(*, deprecated, message: "This operation is deprecated.") - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -182,8 +180,8 @@ open class PetAPI { open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "tags": tags.encodeToJSON() @@ -201,7 +199,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?,_ error: Error?) -> Void)) { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) { getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,8 +226,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -244,7 +242,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -285,7 +283,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -313,14 +311,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "name": name?.encodeToJSON(), "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -337,7 +335,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -365,14 +363,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -389,7 +387,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -417,14 +415,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 3848eda85ad69cbca414345076b6c6a1eeea6bc3..a8a83eda39a4e7ee3a7cc86e3ce0d0bc26e7182c 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class StoreAPI { /** Delete purchase order by ID @@ -17,7 +15,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -41,8 +39,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -56,7 +54,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String:Int]?,_ error: Error?) -> Void)) { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) { getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -76,14 +74,14 @@ open class StoreAPI { - name: api_key - returns: RequestBuilder<[String:Int]> */ - open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { let path = "/store/inventory" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } @@ -95,7 +93,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -119,8 +117,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -135,7 +133,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 546166841d9e6987c83402f734038868be6c3997..505ed1b0c5c9995b0bc45aa233212d11a8e515e9 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class UserAPI { /** Create user @@ -17,7 +15,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -54,7 +52,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -90,7 +88,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -126,7 +124,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -150,8 +148,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -166,7 +164,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?,_ error: Error?) -> Void)) { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) { getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -189,8 +187,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -206,7 +204,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,11 +226,11 @@ open class UserAPI { open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username.encodeToJSON(), + "username": username.encodeToJSON(), "password": password.encodeToJSON() ]) @@ -247,7 +245,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -266,8 +264,8 @@ open class UserAPI { open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -283,7 +281,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 01b28a4bd42d21245b26f53ba2766a44c3ff0d38..ef971ebadc60ae1d358d9d87e8727aa13ec7437b 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -45,4 +45,4 @@ open class CodableHelper { open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { return Swift.Result { try self.jsonEncoder.encode(value) } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift index f171525e43944f9cedf0e5146a39752fc2e848dc..627d9adb757ef30f3bf44723748aee6b5f1913d9 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,10 +7,10 @@ import Foundation open class Configuration { - + // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} \ No newline at end of file + +} 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 6e279679c67a1e7e3f302fc0fcbfd5b58a6dd12f..93ed6b90b376a7b84e9eabb1705f3dcb8bd98a14 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -108,24 +108,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { if let values = values { try encodeArray(values, forKey: key) } } - public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable { + public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable { + public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { - var tmpArray: [T]? = nil + public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? if contains(key) { tmpArray = try decodeArray(T.self, forKey: key) @@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable { - var map: [Self.Key : T] = [:] + public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -177,5 +177,3 @@ extension HTTPURLResponse { return Array(200 ..< 300).contains(statusCode) } } - - diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift index 08f1ef334dff10656c28e298c6b9b6d754159d73..b79e9f5e64d518e51552c62467884931ee1eaf3c 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -41,7 +41,7 @@ public struct JSONDataEncoding { } public static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? = nil + var returnedParams: [String: Any]? if let jsonData = jsonData, !jsonData.isEmpty { var params: [String: Any] = [:] params[jsonDataKey] = jsonData diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 314f1eff1f9b07d17db1930bfbe566baedbbc5cc..02f78ffb47056ddebac110679c4b545ed2861125 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -9,8 +9,8 @@ import Foundation open class JSONEncodingHelper { - open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? = nil + open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? // Encode the Encodable object if let encodableObj = encodableObj { @@ -27,7 +27,7 @@ open class JSONEncodingHelper { } open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? = nil + var params: [String: Any]? if let encodableObj = encodableObj { do { @@ -41,5 +41,5 @@ open class JSONEncodingHelper { return params } - + } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift index 11e81ffcc472bbe9ca94aecdf5b731470979d0de..c0542c14c0812d73834b48ba2123704b096bd61c 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,11 +10,11 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse : Error { +public enum ErrorResponse: Error { case error(Int, Data?, Error) } -public enum DownloadException : Error { +public enum DownloadException: Error { case responseDataMissing case responseFailed case requestMissing @@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error { case generalError(Error) } - open class Response<T> { public let statusCode: Int public let header: [String: String] @@ -44,7 +43,7 @@ open class Response<T> { public convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String:String]() + var header = [String: String]() for (key, value) in rawHeader { if let key = key.base as? String, let value = value as? String { header[key] = value diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 28ca8377b889b8436d0d11797c89daaa27864e9f..1af0315359678116da5f18a94457d0d2a1178e51 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,19 +7,17 @@ import Foundation +public struct AdditionalPropertiesClass: Codable { -public struct AdditionalPropertiesClass: Codable { + public var mapString: [String: String]? + public var mapMapString: [String: [String: String]]? - - public var mapString: [String:String]? - public var mapMapString: [String:[String:String]]? - - public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { + public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { self.mapString = mapString self.mapMapString = mapMapString } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapString = "map_string" case mapMapString = "map_map_string" } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index 1050d79dbe9df42e68f40f036c83f858d3cfd441..5ed9f31e2a364d0bf7a25bdf70cecb48af6ab5c4 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Animal: Codable { - +public struct Animal: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift index e7bea63f8ed28132865ea4d3c23eab55666cf4f6..e09b0e9efdc8ca7798114f24aff21f57e8f9fabd 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -7,5 +7,4 @@ import Foundation - public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index 4d0393b9ba45fb26499017214280bf04637ebe09..ec270da8907438877ee5cc303b093ceba3993297 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ApiResponse: Codable { - +public struct ApiResponse: Codable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 1363c96394baf0514e28045c00399b49591a962d..6c252ed475b2ed17ed9cd5a9eee4db0348886338 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfArrayOfNumberOnly: Codable { - +public struct ArrayOfArrayOfNumberOnly: Codable { public var arrayArrayNumber: [[Double]]? @@ -17,7 +15,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable { self.arrayArrayNumber = arrayArrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayArrayNumber = "ArrayArrayNumber" } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index 6b8873730c43cabe3911148ca8edc15b468d0a17..e84eb5d650258b37fdd423fadcfe1c7fc63962df 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfNumberOnly: Codable { - +public struct ArrayOfNumberOnly: Codable { public var arrayNumber: [Double]? @@ -17,7 +15,7 @@ public struct ArrayOfNumberOnly: Codable { self.arrayNumber = arrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayNumber = "ArrayNumber" } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index 64f7c6d9db99f4927f985c425f33a0d435c7d701..d2140933d1817725be708b41da4e996a549f3896 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayTest: Codable { - +public struct ArrayTest: Codable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? @@ -21,7 +19,7 @@ public struct ArrayTest: Codable { self.arrayArrayOfModel = arrayArrayOfModel } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayOfString = "array_of_string" case arrayArrayOfInteger = "array_array_of_integer" case arrayArrayOfModel = "array_array_of_model" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index ddb669a590459e81909408e9d2d9bc40dadfd38e..d1b3b27616edc9a2da27adb54c6b95ce056f8e91 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Capitalization: Codable { - +public struct Capitalization: Codable { public var smallCamel: String? public var capitalCamel: String? @@ -28,7 +26,7 @@ public struct Capitalization: Codable { self.ATT_NAME = ATT_NAME } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case smallCamel case capitalCamel = "CapitalCamel" case smallSnake = "small_Snake" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index c4f6e0d488caad736393f8a8936e5db63fec5378..7ab887f3113f1dd39f42b1019d8f58d45325f288 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Cat: Codable { - +public struct Cat: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift index 7b1d7e32be80ed62c3c1dda290093a4ea02a6c7b..a51ad0dffab1ba129591056cd816575af0e1ea09 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct CatAllOf: Codable { - +public struct CatAllOf: Codable { public var declawed: Bool? diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 3ec00f5ab10d19c5cd961c6316c9ec7960a85c57..eb8f7e5e1974989058473e4492c25c0004f1078c 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Category: Codable { - +public struct Category: Codable { public var id: Int64? public var name: String = "default-name" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index af030c3dd6269b59f42af7280976d3fa9dee9425..e2a7d4427a061dd104df50c1922ab1446e549106 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Codable { - +public struct ClassModel: Codable { public var _class: String? diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index 0aae748c76b4398015bcac633f082d0fbd84531a..00245ca37280eea9c87184eb0f40fb8bf03b81f2 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Client: Codable { - +public struct Client: Codable { public var client: String? diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 198e28b94dd6615a5da1b5c9efd0e13c3150de4a..492c1228008eb782ea0f927f65259ce2c7999d24 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Dog: Codable { - +public struct Dog: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift index 8ff49b2af23fc129b73f3bfc3e4c8a6d95b16ea5..7786f8acc5ae7d0de7de7248ef5a94d4d16f0a17 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct DogAllOf: Codable { - +public struct DogAllOf: Codable { public var breed: String? diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index e2d3fa04f94b92473f218965cf21bb8eb8e82ee2..9844e7c40e35868546bb256fd806eb8b30b135f2 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumArrays: Codable { - +public struct EnumArrays: Codable { public enum JustSymbol: String, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -27,7 +25,7 @@ public struct EnumArrays: Codable { self.arrayEnum = arrayEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justSymbol = "just_symbol" case arrayEnum = "array_enum" } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift index c2c639ba3246c2c7d30830770fc80529114eca31..d4029d73f8aff2b20baf7856bb6517a1407731b5 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -7,7 +7,6 @@ import Foundation - public enum EnumClass: String, Codable, CaseIterable { case abc = "_abc" case efg = "-efg" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index a56e1f36389b91b5bf92522d6248b9fc69d3c386..789f583e1d778b6b26d6270fe386e3b88b406488 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumTest: Codable { - +public struct EnumTest: Codable { public enum EnumString: String, Codable, CaseIterable { case upper = "UPPER" @@ -43,7 +41,7 @@ public struct EnumTest: Codable { self.outerEnum = outerEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case enumString = "enum_string" case enumStringRequired = "enum_string_required" case enumInteger = "enum_integer" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift index 773b53b2cb765586e3a14e4034a7c8da7a177363..abf3ccffc48588b98475607b17878c7d03320f48 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,8 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Codable { - +public struct File: Codable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 83dc1148cfa3d6e9bbcb2d78f2d62b38045668b6..532f1457939af300b65f89821673cf1951ec2f0b 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FileSchemaTestClass: Codable { - +public struct FileSchemaTestClass: Codable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index bccd3f9fb1786b11e4d4dc8e97ca6bd3e73f4cab..20bd6d103b3dc87ffa6d7f38b21d957318628930 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FormatTest: Codable { - +public struct FormatTest: Codable { public var integer: Int? public var int32: Int? diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index 566d71a35ef0193c3e0ca140a6adabfcdc84588f..906ddb06fb170e5de30f07754fce3efc4f512ee1 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct HasOnlyReadOnly: Codable { - +public struct HasOnlyReadOnly: Codable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 80cecab242f25976c3ac5b7538ca07f7d1a1e1b8..fe13d302ccbfde321339be7d09f6932248c2570e 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,9 +7,7 @@ import Foundation - -public struct List: Codable { - +public struct List: Codable { public var _123list: String? @@ -17,7 +15,7 @@ public struct List: Codable { self._123list = _123list } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _123list = "123-list" } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index f0c02de95f7abe0f4bd7fac695d9c590120d8504..4b6037f378ee6b0152805f8b11d374a16373e222 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,27 +7,25 @@ import Foundation - -public struct MapTest: Codable { - +public struct MapTest: Codable { public enum MapOfEnumString: String, Codable, CaseIterable { case upper = "UPPER" case lower = "lower" } - public var mapMapOfString: [String:[String:String]]? - public var mapOfEnumString: [String:String]? - public var directMap: [String:Bool]? + public var mapMapOfString: [String: [String: String]]? + public var mapOfEnumString: [String: String]? + public var directMap: [String: Bool]? public var indirectMap: StringBooleanMap? - public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) { + public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { self.mapMapOfString = mapMapOfString self.mapOfEnumString = mapOfEnumString self.directMap = directMap self.indirectMap = indirectMap } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapMapOfString = "map_map_of_string" case mapOfEnumString = "map_of_enum_string" case directMap = "direct_map" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 710e62a9b5875c830a4885dac70b0bedb56d32b2..c3deb2f28932f5d0ab338f3da2ac398de24a8822 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,15 +7,13 @@ import Foundation - -public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { - +public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { public var uuid: UUID? public var dateTime: Date? - public var map: [String:Animal]? + public var map: [String: Animal]? - public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) { + public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { self.uuid = uuid self.dateTime = dateTime self.map = map diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index 450a53b918ca0d82e9697268575f6315bd76e1c7..b61db7d6e716185b1b6f21ac2c536f3d5e408809 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Codable { - +public struct Model200Response: Codable { public var name: Int? public var _class: String? @@ -19,7 +18,7 @@ public struct Model200Response: Codable { self._class = _class } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case _class = "class" } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index 6deb69fcd7313698cb05f790654c47f98a303665..8ab4db44b73a3726cc854651fef382bd9fcf69b6 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Codable { - +public struct Name: Codable { public var name: Int public var snakeCase: Int? @@ -23,7 +22,7 @@ public struct Name: Codable { self._123number = _123number } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case snakeCase = "snake_case" case property diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 0c9ee2b7b9f4a7fcd3a7c1ed1e142e8fcce4cf84..4d1dafcc2c1f56bf9c7e317734efc71ee9fbd09a 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct NumberOnly: Codable { - +public struct NumberOnly: Codable { public var justNumber: Double? @@ -17,7 +15,7 @@ public struct NumberOnly: Codable { self.justNumber = justNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justNumber = "JustNumber" } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index ab0eac0b304e4a248aa897d86579bde395947b77..40c30cc8609c33fd59240aae30ba7d942e4d3659 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Order: Codable { - +public struct Order: Codable { public enum Status: String, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 4a7d227104413d7065789fa87b4c2f41078130a0..18c3a024f1227af549fb1b13b1838f1e81a837b1 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,9 +7,7 @@ import Foundation - -public struct OuterComposite: Codable { - +public struct OuterComposite: Codable { public var myNumber: Double? public var myString: String? @@ -21,7 +19,7 @@ public struct OuterComposite: Codable { self.myBoolean = myBoolean } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case myNumber = "my_number" case myString = "my_string" case myBoolean = "my_boolean" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift index 9e6b8d74e874c1d75bf8afbb92296996e39cf366..c3b778cbbed444c54045dedb48213ce3bb532dbf 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -7,7 +7,6 @@ import Foundation - public enum OuterEnum: String, Codable, CaseIterable { case placed = "placed" case approved = "approved" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index a973071d6c9615c7e082183ec555eb794bb11b3b..b9ce0e933256c401ced1143aaa31936cf60bdb63 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Pet: Codable { - +public struct Pet: Codable { public enum Status: String, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index b2a6b7e2b8a61e14c75f22de2da766e96afc1fca..0acd21fd10000317ffc9f96840a49b3dd538d0c7 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ReadOnlyFirst: Codable { - +public struct ReadOnlyFirst: Codable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index 7e089dcee2b4a366353619ee201eb067bb63ed71..c223f993a69ece3abf5451c68d01eb666dad5b19 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Codable { - +public struct Return: Codable { public var _return: Int? @@ -17,7 +16,7 @@ public struct Return: Codable { self._return = _return } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _return = "return" } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index e890ef952520010cb37b71b4f4c06215b4f7c88c..6e8650f76d8ece4a8511cf0afacf62816e852598 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,9 +7,7 @@ import Foundation - -public struct SpecialModelName: Codable { - +public struct SpecialModelName: Codable { public var specialPropertyName: Int64? @@ -17,7 +15,7 @@ public struct SpecialModelName: Codable { self.specialPropertyName = specialPropertyName } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case specialPropertyName = "$special[property.name]" } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index f65ae0623d6e8567ed17f651d3c0ff056fefb1ba..3f1237fee477a298b1d99cef8062371e2f101f59 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,12 +7,9 @@ import Foundation +public struct StringBooleanMap: Codable { -public struct StringBooleanMap: Codable { - - - - public var additionalProperties: [String:Bool] = [:] + public var additionalProperties: [String: Bool] = [:] public subscript(key: String) -> Bool? { get { @@ -45,5 +42,4 @@ public struct StringBooleanMap: Codable { additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index a91b6061bcf78c8ad31d4ae87401afa4ac72330b..4dd8a9a9f5a0fc547c88401b39caf0f00cddd61d 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Tag: Codable { - +public struct Tag: Codable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index 2d377c3edb02c59cbf82ae4bc9534eba7c3f3e2b..a9e088808ed378dfa9690f8dfa1fc687294bd3bd 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderDefault: Codable { - +public struct TypeHolderDefault: Codable { public var stringItem: String = "what" public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderDefault: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index e5eb92da696e19c998edd122f874f9f7fa776148..dff4083ae43260c42e61413843b52749b26b6769 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderExample: Codable { - +public struct TypeHolderExample: Codable { public var stringItem: String public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderExample: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift index f70328ca9e597ffca3abc70b5340fda99848a4d1..79f271ed73564b8af07f2698e649f38062255ce7 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,9 +7,7 @@ import Foundation - -public struct User: Codable { - +public struct User: Codable { public var id: Int64? public var username: String? 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 22261e2ce9483f4ac59c12ff516a53863a606132..55d0eb42191942998769644daea74ffeb51cbcd7 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -14,7 +14,7 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { return URLSessionRequestBuilder<T>.self } - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type { + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { return URLSessionDecodableRequestBuilder<T>.self } } @@ -23,16 +23,16 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { private var urlSessionStore = SynchronizedDictionary<String, URLSession>() open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - + private var observation: NSKeyValueObservation? - + deinit { observation?.invalidate() } - + // swiftlint:disable:next weak_delegate fileprivate let sessionDelegate = SessionDelegate() - + /** May be assigned if you want to control the authentication challenges. */ @@ -45,11 +45,11 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - retry the request. */ public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? - - required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { + + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } - + /** May be overridden by a subclass if you want to control the URLSession configuration. @@ -77,40 +77,40 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { May be overridden by a subclass if you want to control the URLRequest configuration (e.g. to override the cache policy). */ - open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) throws -> URLRequest { - + open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { + guard let url = URL(string: URLString) else { throw DownloadException.requestMissingURL } - + var originalRequest = URLRequest(url: url) - + originalRequest.httpMethod = method.rawValue - + buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + headers.forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) - + return modifiedRequest } override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { - let urlSessionId:String = UUID().uuidString + let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() urlSessionStore[urlSessionId] = urlSession - + let parameters: [String: Any] = self.parameters ?? [:] - + let fileKeys = parameters.filter { $1 is URL } .map { $0.0 } - + let encoding: ParameterEncoding if fileKeys.count > 0 { encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) @@ -119,29 +119,29 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } else { encoding = URLEncoding() } - + guard let xMethod = HTTPMethod(rawValue: method) else { fatalError("Unsuported Http method - \(method)") } - + let cleanupRequest = { urlSessionStore[urlSessionId] = nil self.observation?.invalidate() } - + do { let request = try createURLRequest(urlSession: urlSession, method: xMethod, encoding: encoding, headers: headers) - + let dataTask = urlSession.dataTask(with: request) { [weak self] data, response, error in - + guard let self = self else { return } - + if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - + taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - + guard let self = self else { return } - + if shouldRetry { cleanupRequest() self.execute(apiResponseQueue, completion) @@ -157,13 +157,13 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } } - + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { onProgressReady?(dataTask.progress) } - + dataTask.resume() - + } catch { apiResponseQueue.async { cleanupRequest() @@ -172,7 +172,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } - + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -192,52 +192,52 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is URL.Type: do { - + guard error == nil else { throw DownloadException.responseFailed } - + guard let data = data else { throw DownloadException.responseDataMissing } - + let fileManager = FileManager.default let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] let requestURL = try self.getURL(from: urlRequest) - + var requestPath = try self.getPath(from: requestURL) - + if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { requestPath = requestPath.appending("/\(headerFileName)") } - + let filePath = documentsDirectory.appendingPathComponent(requestPath) let directoryPath = filePath.deletingLastPathComponent().path - + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) - + completion(.success(Response(response: httpResponse, body: filePath as? T))) - + } catch let requestParserError as DownloadException { completion(.failure(ErrorResponse.error(400, data, requestParserError))) } catch let error { completion(.failure(ErrorResponse.error(400, data, error))) } - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + default: - + completion(.success(Response(response: httpResponse, body: data as? T))) } @@ -251,7 +251,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { guard let contentDisposition = contentDisposition else { return nil @@ -270,7 +270,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { filename = contentItem return filename? - .replacingCharacters(in: range, with:"") + .replacingCharacters(in: range, with: "") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } @@ -279,7 +279,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getPath(from url : URL) throws -> String { + fileprivate func getPath(from url: URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath @@ -293,7 +293,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL @@ -304,7 +304,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } -open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuilder<T> { +open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -324,28 +324,28 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + case is Data.Type: - + completion(.success(Response(response: httpResponse, body: data as? T))) - + default: - + guard let data = data, !data.isEmpty else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse))) return } - + let decodeResult = CodableHelper.decode(T.self, from: data) - + switch decodeResult { case let .success(decodableObj): completion(.success(Response(response: httpResponse, body: decodableObj))) @@ -356,10 +356,10 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil } } -fileprivate class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { - +private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { + var credential: URLCredential? - + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { @@ -402,13 +402,13 @@ public protocol ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest } -fileprivate class URLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) throws -> URLRequest { - +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - + guard let parameters = parameters else { return urlRequest } - + guard let url = urlRequest.url else { throw DownloadException.requestMissingURL } @@ -417,12 +417,12 @@ fileprivate class URLEncoding: ParameterEncoding { urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) urlRequest.url = urlComponents.url } - + return urlRequest } } -fileprivate class FileUploadEncoding: ParameterEncoding { +private class FileUploadEncoding: ParameterEncoding { let contentTypeForFormPart: (_ fileURL: URL) -> String? @@ -433,13 +433,13 @@ fileprivate class FileUploadEncoding: ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { var urlRequest = urlRequest - + guard let parameters = parameters, !parameters.isEmpty else { return urlRequest } - + let boundary = "Boundary-\(UUID().uuidString)" - + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") for (key, value) in parameters { @@ -479,7 +479,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { fatalError("Unprocessable value \(value) with key \(key)") } } - + var body = urlRequest.httpBody.orEmpty body.append("\r\n--\(boundary)--\r\n") @@ -494,7 +494,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { var urlRequest = urlRequest var body = urlRequest.httpBody.orEmpty - + let fileData = try Data(contentsOf: fileURL) let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) @@ -502,7 +502,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } @@ -518,20 +518,20 @@ fileprivate class FileUploadEncoding: ParameterEncoding { // The value data. body.append(fileData) - + urlRequest.httpBody = body return urlRequest } - + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { var urlRequest = urlRequest - + var body = urlRequest.httpBody.orEmpty // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") }