forked from loafle/openapi-generator-original
Merge branch 'master' of https://github.com/openapitools/openapi-generator
This commit is contained in:
commit
8cf34ca80f
@ -22,7 +22,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?] {
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
|
||||
} else if let value: Any = item.value {
|
||||
result[item.key] = "\(value)"
|
||||
@ -46,7 +46,7 @@ public struct APIHelper {
|
||||
}
|
||||
|
||||
public static func mapValueToPathItem(_ source: Any) -> Any {
|
||||
if let collection = source as? [Any?] {
|
||||
if let collection = source as? Array<Any?> {
|
||||
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
}
|
||||
return source
|
||||
@ -54,7 +54,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?] {
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
result.append(URLQueryItem(name: item.key, value: value))
|
||||
} else if let value = item.value {
|
||||
|
@ -22,7 +22,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?] {
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
|
||||
} else if let value: Any = item.value {
|
||||
result[item.key] = "\(value)"
|
||||
@ -46,7 +46,7 @@ public struct APIHelper {
|
||||
}
|
||||
|
||||
public static func mapValueToPathItem(_ source: Any) -> Any {
|
||||
if let collection = source as? [Any?] {
|
||||
if let collection = source as? Array<Any?> {
|
||||
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
}
|
||||
return source
|
||||
@ -54,7 +54,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?] {
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
result.append(URLQueryItem(name: item.key, value: value))
|
||||
} else if let value = item.value {
|
||||
|
@ -9,12 +9,12 @@ 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.0"),
|
||||
.package(url: "https://github.com/mxcl/PromiseKit.git", from: "6.11.0"),
|
||||
.package(url: "https://github.com/mxcl/PromiseKit.git", from: "6.11.0")
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||
@ -23,6 +23,6 @@ let package = Package(
|
||||
name: "PetstoreClient",
|
||||
dependencies: ["Alamofire", "PromiseKit"],
|
||||
path: "PetstoreClient/Classes"
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
|
@ -22,7 +22,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?] {
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
|
||||
} else if let value: Any = item.value {
|
||||
result[item.key] = "\(value)"
|
||||
@ -46,7 +46,7 @@ public struct APIHelper {
|
||||
}
|
||||
|
||||
public static func mapValueToPathItem(_ source: Any) -> Any {
|
||||
if let collection = source as? [Any?] {
|
||||
if let collection = source as? Array<Any?> {
|
||||
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
}
|
||||
return source
|
||||
@ -54,7 +54,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?] {
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
result.append(URLQueryItem(name: item.key, value: value))
|
||||
} else if let value = item.value {
|
||||
|
@ -22,7 +22,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?] {
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
|
||||
} else if let value: Any = item.value {
|
||||
result[item.key] = "\(value)"
|
||||
@ -46,7 +46,7 @@ public struct APIHelper {
|
||||
}
|
||||
|
||||
public static func mapValueToPathItem(_ source: Any) -> Any {
|
||||
if let collection = source as? [Any?] {
|
||||
if let collection = source as? Array<Any?> {
|
||||
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
}
|
||||
return source
|
||||
@ -54,7 +54,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?] {
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
result.append(URLQueryItem(name: item.key, value: value))
|
||||
} else if let value = item.value {
|
||||
|
@ -22,7 +22,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?] {
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
|
||||
} else if let value: Any = item.value {
|
||||
result[item.key] = "\(value)"
|
||||
@ -46,7 +46,7 @@ public struct APIHelper {
|
||||
}
|
||||
|
||||
public static func mapValueToPathItem(_ source: Any) -> Any {
|
||||
if let collection = source as? [Any?] {
|
||||
if let collection = source as? Array<Any?> {
|
||||
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
}
|
||||
return source
|
||||
@ -54,7 +54,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?] {
|
||||
if let collection = item.value as? Array<Any?> {
|
||||
let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
|
||||
result.append(URLQueryItem(name: item.key, value: value))
|
||||
} else if let value = item.value {
|
||||
|
Loading…
x
Reference in New Issue
Block a user