mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-09 05:06:12 +00:00
[Swift 5] deprecate retry hook since its no longer needed (#8303)
* [Swift 5] deprecated retry hook since its no longer needed * [Swift 5] deprecated retry hook since its no longer needed * [swift] fix generator code formatting
This commit is contained in:
@@ -23,7 +23,7 @@ public struct APIHelper {
|
||||
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
|
||||
return source.reduce(into: [String: String]()) { (result, item) in
|
||||
if let collection = item.value as? [Any?] {
|
||||
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
|
||||
result[item.key] = collection.filter { $0 != nil }.map { "\($0!)" }.joined(separator: ",")
|
||||
} else if let value: Any = item.value {
|
||||
result[item.key] = "\(value)"
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public struct APIHelper {
|
||||
|
||||
public static func mapValueToPathItem(_ source: Any) -> Any {
|
||||
if let collection = source as? [Any?] {
|
||||
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
return collection.filter { $0 != nil }.map {"\($0!)"}.joined(separator: ",")
|
||||
}
|
||||
return source
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public struct APIHelper {
|
||||
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? [Any?] {
|
||||
collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in
|
||||
collection.filter { $0 != nil }.map {"\($0!)"}.forEach { value in
|
||||
result.append(URLQueryItem(name: item.key, value: value))
|
||||
}
|
||||
} else if let value = item.value {
|
||||
|
||||
@@ -44,6 +44,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> {
|
||||
- intercept and handle errors like authorization
|
||||
- retry the request.
|
||||
*/
|
||||
@available(*, deprecated, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
|
||||
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] = [:]) {
|
||||
|
||||
Reference in New Issue
Block a user