mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-24 09:40:53 +00:00
run swiftlint latest version on swift samples (#6788)
This commit is contained in:
parent
5cce9dc7d3
commit
720ab3d39b
@ -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"
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
|
@ -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? Array<Any?> {
|
||||
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)"
|
||||
@ -46,7 +46,7 @@ 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
|
||||
@ -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? 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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ open class RequestBuilder<T> {
|
||||
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] = [:]) {
|
||||
self.method = method
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
|
||||
open class AnotherFakeAPI {
|
||||
/**
|
||||
To test special tags
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
|
||||
open class FakeAPI {
|
||||
/**
|
||||
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
|
||||
open class FakeClassnameTags123API {
|
||||
/**
|
||||
To test class name in snake case
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
|
||||
open class PetAPI {
|
||||
/**
|
||||
Add a new pet to the store
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
|
||||
open class StoreAPI {
|
||||
/**
|
||||
Delete purchase order by ID
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
|
||||
open class UserAPI {
|
||||
/**
|
||||
Create user
|
||||
|
@ -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:
|
||||
@ -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 {
|
||||
|
||||
|
@ -148,7 +148,7 @@ extension KeyedDecodingContainerProtocol {
|
||||
}
|
||||
|
||||
public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable {
|
||||
var tmpArray: [T]? = nil
|
||||
var tmpArray: [T]?
|
||||
|
||||
if contains(key) {
|
||||
tmpArray = try decodeArray(T.self, forKey: key)
|
||||
@ -177,5 +177,3 @@ extension HTTPURLResponse {
|
||||
return Array(200 ..< 300).contains(statusCode)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
open class JSONEncodingHelper {
|
||||
|
||||
open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? {
|
||||
var params: [String: Any]? = nil
|
||||
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 {
|
||||
|
@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error {
|
||||
case generalError(Error)
|
||||
}
|
||||
|
||||
|
||||
open class Response<T> {
|
||||
public let statusCode: Int
|
||||
public let header: [String: String]
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct AdditionalPropertiesClass: Codable {
|
||||
|
||||
|
||||
public var mapString: [String: String]?
|
||||
public var mapMapString: [String: [String: String]]?
|
||||
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Animal: Codable {
|
||||
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
|
||||
|
@ -7,5 +7,4 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public typealias AnimalFarm = [Animal]
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ApiResponse: Codable {
|
||||
|
||||
|
||||
public var code: Int?
|
||||
public var type: String?
|
||||
public var message: String?
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ArrayOfArrayOfNumberOnly: Codable {
|
||||
|
||||
|
||||
public var arrayArrayNumber: [[Double]]?
|
||||
|
||||
public init(arrayArrayNumber: [[Double]]?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ArrayOfNumberOnly: Codable {
|
||||
|
||||
|
||||
public var arrayNumber: [Double]?
|
||||
|
||||
public init(arrayNumber: [Double]?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ArrayTest: Codable {
|
||||
|
||||
|
||||
public var arrayOfString: [String]?
|
||||
public var arrayArrayOfInteger: [[Int64]]?
|
||||
public var arrayArrayOfModel: [[ReadOnlyFirst]]?
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Capitalization: Codable {
|
||||
|
||||
|
||||
public var smallCamel: String?
|
||||
public var capitalCamel: String?
|
||||
public var smallSnake: String?
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Cat: Codable {
|
||||
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
public var declawed: Bool?
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct CatAllOf: Codable {
|
||||
|
||||
|
||||
public var declawed: Bool?
|
||||
|
||||
public init(declawed: Bool?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Category: Codable {
|
||||
|
||||
|
||||
public var id: Int64?
|
||||
public var name: String = "default-name"
|
||||
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
/** Model for testing model with \"_class\" property */
|
||||
public struct ClassModel: Codable {
|
||||
|
||||
|
||||
public var _class: String?
|
||||
|
||||
public init(_class: String?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Client: Codable {
|
||||
|
||||
|
||||
public var client: String?
|
||||
|
||||
public init(client: String?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Dog: Codable {
|
||||
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
public var breed: String?
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct DogAllOf: Codable {
|
||||
|
||||
|
||||
public var breed: String?
|
||||
|
||||
public init(breed: String?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct EnumArrays: Codable {
|
||||
|
||||
|
||||
public enum JustSymbol: String, Codable, CaseIterable {
|
||||
case greaterThanOrEqualTo = ">="
|
||||
case dollar = "$"
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public enum EnumClass: String, Codable, CaseIterable {
|
||||
case abc = "_abc"
|
||||
case efg = "-efg"
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct EnumTest: Codable {
|
||||
|
||||
|
||||
public enum EnumString: String, Codable, CaseIterable {
|
||||
case upper = "UPPER"
|
||||
case lower = "lower"
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
/** Must be named `File` for test. */
|
||||
public struct File: Codable {
|
||||
|
||||
|
||||
/** Test capitalization */
|
||||
public var sourceURI: String?
|
||||
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct FileSchemaTestClass: Codable {
|
||||
|
||||
|
||||
public var file: File?
|
||||
public var files: [File]?
|
||||
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct FormatTest: Codable {
|
||||
|
||||
|
||||
public var integer: Int?
|
||||
public var int32: Int?
|
||||
public var int64: Int64?
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct HasOnlyReadOnly: Codable {
|
||||
|
||||
|
||||
public var bar: String?
|
||||
public var foo: String?
|
||||
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct List: Codable {
|
||||
|
||||
|
||||
public var _123list: String?
|
||||
|
||||
public init(_123list: String?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct MapTest: Codable {
|
||||
|
||||
|
||||
public enum MapOfEnumString: String, Codable, CaseIterable {
|
||||
case upper = "UPPER"
|
||||
case lower = "lower"
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {
|
||||
|
||||
|
||||
public var uuid: UUID?
|
||||
public var dateTime: Date?
|
||||
public var map: [String: Animal]?
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
/** Model for testing model name starting with number */
|
||||
public struct Model200Response: Codable {
|
||||
|
||||
|
||||
public var name: Int?
|
||||
public var _class: String?
|
||||
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
/** Model for testing model name same as property name */
|
||||
public struct Name: Codable {
|
||||
|
||||
|
||||
public var name: Int
|
||||
public var snakeCase: Int?
|
||||
public var property: String?
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct NumberOnly: Codable {
|
||||
|
||||
|
||||
public var justNumber: Double?
|
||||
|
||||
public init(justNumber: Double?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Order: Codable {
|
||||
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case placed = "placed"
|
||||
case approved = "approved"
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct OuterComposite: Codable {
|
||||
|
||||
|
||||
public var myNumber: Double?
|
||||
public var myString: String?
|
||||
public var myBoolean: Bool?
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public enum OuterEnum: String, Codable, CaseIterable {
|
||||
case placed = "placed"
|
||||
case approved = "approved"
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Pet: Codable {
|
||||
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
case pending = "pending"
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ReadOnlyFirst: Codable {
|
||||
|
||||
|
||||
public var bar: String?
|
||||
public var baz: String?
|
||||
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
/** Model for testing reserved words */
|
||||
public struct Return: Codable {
|
||||
|
||||
|
||||
public var _return: Int?
|
||||
|
||||
public init(_return: Int?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct SpecialModelName: Codable {
|
||||
|
||||
|
||||
public var specialPropertyName: Int64?
|
||||
|
||||
public init(specialPropertyName: Int64?) {
|
||||
|
@ -7,11 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct StringBooleanMap: Codable {
|
||||
|
||||
|
||||
|
||||
public var additionalProperties: [String: Bool] = [:]
|
||||
|
||||
public subscript(key: String) -> Bool? {
|
||||
@ -45,5 +42,4 @@ public struct StringBooleanMap: Codable {
|
||||
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Tag: Codable {
|
||||
|
||||
|
||||
public var id: Int64?
|
||||
public var name: String?
|
||||
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct TypeHolderDefault: Codable {
|
||||
|
||||
|
||||
public var stringItem: String = "what"
|
||||
public var numberItem: Double
|
||||
public var integerItem: Int
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct TypeHolderExample: Codable {
|
||||
|
||||
|
||||
public var stringItem: String
|
||||
public var numberItem: Double
|
||||
public var integerItem: Int
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct User: Codable {
|
||||
|
||||
|
||||
public var id: Int64?
|
||||
public var username: String?
|
||||
public var firstName: String?
|
||||
|
@ -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"
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
|
@ -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? Array<Any?> {
|
||||
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)"
|
||||
@ -46,7 +46,7 @@ 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
|
||||
@ -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? 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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ 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] = [:]) {
|
||||
self.method = method
|
||||
|
@ -8,8 +8,6 @@
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
|
||||
|
||||
open class AnotherFakeAPI {
|
||||
/**
|
||||
To test special tags
|
||||
|
@ -8,8 +8,6 @@
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
|
||||
|
||||
open class FakeAPI {
|
||||
/**
|
||||
|
||||
|
@ -8,8 +8,6 @@
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
|
||||
|
||||
open class FakeClassnameTags123API {
|
||||
/**
|
||||
To test class name in snake case
|
||||
|
@ -8,8 +8,6 @@
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
|
||||
|
||||
open class PetAPI {
|
||||
/**
|
||||
Add a new pet to the store
|
||||
|
@ -8,8 +8,6 @@
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
|
||||
|
||||
open class StoreAPI {
|
||||
/**
|
||||
Delete purchase order by ID
|
||||
|
@ -8,8 +8,6 @@
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
|
||||
|
||||
open class UserAPI {
|
||||
/**
|
||||
Create user
|
||||
|
@ -148,7 +148,7 @@ extension KeyedDecodingContainerProtocol {
|
||||
}
|
||||
|
||||
public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable {
|
||||
var tmpArray: [T]? = nil
|
||||
var tmpArray: [T]?
|
||||
|
||||
if contains(key) {
|
||||
tmpArray = try decodeArray(T.self, forKey: key)
|
||||
@ -177,5 +177,3 @@ extension HTTPURLResponse {
|
||||
return Array(200 ..< 300).contains(statusCode)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
open class JSONEncodingHelper {
|
||||
|
||||
open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? {
|
||||
var params: [String: Any]? = nil
|
||||
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 {
|
||||
|
@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error {
|
||||
case generalError(Error)
|
||||
}
|
||||
|
||||
|
||||
open class Response<T> {
|
||||
public let statusCode: Int
|
||||
public let header: [String: String]
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct AdditionalPropertiesClass: Codable {
|
||||
|
||||
|
||||
public var mapString: [String: String]?
|
||||
public var mapMapString: [String: [String: String]]?
|
||||
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Animal: Codable {
|
||||
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
|
||||
|
@ -7,5 +7,4 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public typealias AnimalFarm = [Animal]
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ApiResponse: Codable {
|
||||
|
||||
|
||||
public var code: Int?
|
||||
public var type: String?
|
||||
public var message: String?
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ArrayOfArrayOfNumberOnly: Codable {
|
||||
|
||||
|
||||
public var arrayArrayNumber: [[Double]]?
|
||||
|
||||
public init(arrayArrayNumber: [[Double]]?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ArrayOfNumberOnly: Codable {
|
||||
|
||||
|
||||
public var arrayNumber: [Double]?
|
||||
|
||||
public init(arrayNumber: [Double]?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ArrayTest: Codable {
|
||||
|
||||
|
||||
public var arrayOfString: [String]?
|
||||
public var arrayArrayOfInteger: [[Int64]]?
|
||||
public var arrayArrayOfModel: [[ReadOnlyFirst]]?
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Capitalization: Codable {
|
||||
|
||||
|
||||
public var smallCamel: String?
|
||||
public var capitalCamel: String?
|
||||
public var smallSnake: String?
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Cat: Codable {
|
||||
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
public var declawed: Bool?
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct CatAllOf: Codable {
|
||||
|
||||
|
||||
public var declawed: Bool?
|
||||
|
||||
public init(declawed: Bool?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Category: Codable {
|
||||
|
||||
|
||||
public var id: Int64?
|
||||
public var name: String = "default-name"
|
||||
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
/** Model for testing model with \"_class\" property */
|
||||
public struct ClassModel: Codable {
|
||||
|
||||
|
||||
public var _class: String?
|
||||
|
||||
public init(_class: String?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Client: Codable {
|
||||
|
||||
|
||||
public var client: String?
|
||||
|
||||
public init(client: String?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Dog: Codable {
|
||||
|
||||
|
||||
public var className: String
|
||||
public var color: String? = "red"
|
||||
public var breed: String?
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct DogAllOf: Codable {
|
||||
|
||||
|
||||
public var breed: String?
|
||||
|
||||
public init(breed: String?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct EnumArrays: Codable {
|
||||
|
||||
|
||||
public enum JustSymbol: String, Codable, CaseIterable {
|
||||
case greaterThanOrEqualTo = ">="
|
||||
case dollar = "$"
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public enum EnumClass: String, Codable, CaseIterable {
|
||||
case abc = "_abc"
|
||||
case efg = "-efg"
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct EnumTest: Codable {
|
||||
|
||||
|
||||
public enum EnumString: String, Codable, CaseIterable {
|
||||
case upper = "UPPER"
|
||||
case lower = "lower"
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
/** Must be named `File` for test. */
|
||||
public struct File: Codable {
|
||||
|
||||
|
||||
/** Test capitalization */
|
||||
public var sourceURI: String?
|
||||
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct FileSchemaTestClass: Codable {
|
||||
|
||||
|
||||
public var file: File?
|
||||
public var files: [File]?
|
||||
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct FormatTest: Codable {
|
||||
|
||||
|
||||
public var integer: Int?
|
||||
public var int32: Int?
|
||||
public var int64: Int64?
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct HasOnlyReadOnly: Codable {
|
||||
|
||||
|
||||
public var bar: String?
|
||||
public var foo: String?
|
||||
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct List: Codable {
|
||||
|
||||
|
||||
public var _123list: String?
|
||||
|
||||
public init(_123list: String?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct MapTest: Codable {
|
||||
|
||||
|
||||
public enum MapOfEnumString: String, Codable, CaseIterable {
|
||||
case upper = "UPPER"
|
||||
case lower = "lower"
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {
|
||||
|
||||
|
||||
public var uuid: UUID?
|
||||
public var dateTime: Date?
|
||||
public var map: [String: Animal]?
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
/** Model for testing model name starting with number */
|
||||
public struct Model200Response: Codable {
|
||||
|
||||
|
||||
public var name: Int?
|
||||
public var _class: String?
|
||||
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
/** Model for testing model name same as property name */
|
||||
public struct Name: Codable {
|
||||
|
||||
|
||||
public var name: Int
|
||||
public var snakeCase: Int?
|
||||
public var property: String?
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct NumberOnly: Codable {
|
||||
|
||||
|
||||
public var justNumber: Double?
|
||||
|
||||
public init(justNumber: Double?) {
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Order: Codable {
|
||||
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case placed = "placed"
|
||||
case approved = "approved"
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct OuterComposite: Codable {
|
||||
|
||||
|
||||
public var myNumber: Double?
|
||||
public var myString: String?
|
||||
public var myBoolean: Bool?
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public enum OuterEnum: String, Codable, CaseIterable {
|
||||
case placed = "placed"
|
||||
case approved = "approved"
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct Pet: Codable {
|
||||
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
case pending = "pending"
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public struct ReadOnlyFirst: Codable {
|
||||
|
||||
|
||||
public var bar: String?
|
||||
public var baz: String?
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user