mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 19:08:52 +00:00
Swift3 xcodewarnings (#6298)
* added headers to makeRequest function for swift3 template * Swift3 update to dismiss Xcode warnings
This commit is contained in:
parent
71123e157e
commit
da4fe86402
@ -58,7 +58,7 @@ open class RequestBuilder<T> {
|
|||||||
|
|
||||||
open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: ErrorResponse?) -> Void) { }
|
open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: ErrorResponse?) -> Void) { }
|
||||||
|
|
||||||
public func addHeader(name: String, value: String) -> Self {
|
@discardableResult public func addHeader(name: String, value: String) -> Self {
|
||||||
if !value.isEmpty {
|
if !value.isEmpty {
|
||||||
headers[name] = value
|
headers[name] = value
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ class Decoders {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func decodeOptional<T: RawRepresentable, U: AnyObject where T.RawValue == U>(clazz: T, source: AnyObject) -> Decoded<T?> {
|
static func decodeOptional<T: RawRepresentable, U: AnyObject>(clazz: T, source: AnyObject) -> Decoded<T?> where T.RawValue == U {
|
||||||
if let value = source as? U {
|
if let value = source as? U {
|
||||||
if let enumValue = T.init(rawValue: value) {
|
if let enumValue = T.init(rawValue: value) {
|
||||||
return .success(enumValue)
|
return .success(enumValue)
|
||||||
|
@ -58,7 +58,7 @@ open class RequestBuilder<T> {
|
|||||||
|
|
||||||
open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: ErrorResponse?) -> Void) { }
|
open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: ErrorResponse?) -> Void) { }
|
||||||
|
|
||||||
public func addHeader(name: String, value: String) -> Self {
|
@discardableResult public func addHeader(name: String, value: String) -> Self {
|
||||||
if !value.isEmpty {
|
if !value.isEmpty {
|
||||||
headers[name] = value
|
headers[name] = value
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ class Decoders {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func decodeOptional<T: RawRepresentable, U: AnyObject where T.RawValue == U>(clazz: T, source: AnyObject) -> Decoded<T?> {
|
static func decodeOptional<T: RawRepresentable, U: AnyObject>(clazz: T, source: AnyObject) -> Decoded<T?> where T.RawValue == U {
|
||||||
if let value = source as? U {
|
if let value = source as? U {
|
||||||
if let enumValue = T.init(rawValue: value) {
|
if let enumValue = T.init(rawValue: value) {
|
||||||
return .success(enumValue)
|
return .success(enumValue)
|
||||||
|
@ -58,7 +58,7 @@ open class RequestBuilder<T> {
|
|||||||
|
|
||||||
open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: ErrorResponse?) -> Void) { }
|
open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: ErrorResponse?) -> Void) { }
|
||||||
|
|
||||||
public func addHeader(name: String, value: String) -> Self {
|
@discardableResult public func addHeader(name: String, value: String) -> Self {
|
||||||
if !value.isEmpty {
|
if !value.isEmpty {
|
||||||
headers[name] = value
|
headers[name] = value
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ class Decoders {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func decodeOptional<T: RawRepresentable, U: AnyObject where T.RawValue == U>(clazz: T, source: AnyObject) -> Decoded<T?> {
|
static func decodeOptional<T: RawRepresentable, U: AnyObject>(clazz: T, source: AnyObject) -> Decoded<T?> where T.RawValue == U {
|
||||||
if let value = source as? U {
|
if let value = source as? U {
|
||||||
if let enumValue = T.init(rawValue: value) {
|
if let enumValue = T.init(rawValue: value) {
|
||||||
return .success(enumValue)
|
return .success(enumValue)
|
||||||
@ -824,7 +824,7 @@ class Decoders {
|
|||||||
}
|
}
|
||||||
// Decoder for OuterBoolean
|
// Decoder for OuterBoolean
|
||||||
Decoders.addDecoder(clazz: OuterBoolean.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterBoolean> in
|
Decoders.addDecoder(clazz: OuterBoolean.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterBoolean> in
|
||||||
if let source = source as? Bool {
|
if let source = source as? OuterBoolean {
|
||||||
return .success(source)
|
return .success(source)
|
||||||
} else {
|
} else {
|
||||||
return .failure(.typeMismatch(expected: "Typealias OuterBoolean", actual: "\(source)"))
|
return .failure(.typeMismatch(expected: "Typealias OuterBoolean", actual: "\(source)"))
|
||||||
@ -864,7 +864,7 @@ class Decoders {
|
|||||||
}
|
}
|
||||||
// Decoder for OuterNumber
|
// Decoder for OuterNumber
|
||||||
Decoders.addDecoder(clazz: OuterNumber.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterNumber> in
|
Decoders.addDecoder(clazz: OuterNumber.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterNumber> in
|
||||||
if let source = source as? Double {
|
if let source = source as? OuterNumber {
|
||||||
return .success(source)
|
return .success(source)
|
||||||
} else {
|
} else {
|
||||||
return .failure(.typeMismatch(expected: "Typealias OuterNumber", actual: "\(source)"))
|
return .failure(.typeMismatch(expected: "Typealias OuterNumber", actual: "\(source)"))
|
||||||
@ -872,7 +872,7 @@ class Decoders {
|
|||||||
}
|
}
|
||||||
// Decoder for OuterString
|
// Decoder for OuterString
|
||||||
Decoders.addDecoder(clazz: OuterString.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterString> in
|
Decoders.addDecoder(clazz: OuterString.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterString> in
|
||||||
if let source = source as? String {
|
if let source = source as? OuterString {
|
||||||
return .success(source)
|
return .success(source)
|
||||||
} else {
|
} else {
|
||||||
return .failure(.typeMismatch(expected: "Typealias OuterString", actual: "\(source)"))
|
return .failure(.typeMismatch(expected: "Typealias OuterString", actual: "\(source)"))
|
||||||
|
@ -25,3 +25,4 @@ open class AdditionalPropertiesClass: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class Animal: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,3 +27,4 @@ open class ApiResponse: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class ArrayOfArrayOfNumberOnly: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class ArrayOfNumberOnly: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,3 +27,4 @@ open class ArrayTest: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,3 +34,4 @@ open class Capitalization: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class Cat: Animal {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class Category: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,3 +24,4 @@ open class ClassModel: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class Client: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class Dog: Animal {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,3 +33,4 @@ open class EnumArrays: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,3 +42,4 @@ open class EnumTest: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,3 +47,4 @@ open class FormatTest: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class HasOnlyReadOnly: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class List: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,3 +28,4 @@ open class MapTest: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,3 +27,4 @@ open class MixedPropertiesAndAdditionalPropertiesClass: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,3 +26,4 @@ open class Model200Response: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,3 +30,4 @@ open class Name: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class NumberOnly: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,3 +39,4 @@ open class Order: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,4 +8,17 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public typealias OuterBoolean = Bool
|
open class OuterBoolean: JSONEncodable {
|
||||||
|
|
||||||
|
|
||||||
|
public init() {}
|
||||||
|
|
||||||
|
// MARK: JSONEncodable
|
||||||
|
open func encodeToJSON() -> Any {
|
||||||
|
var nillableDictionary = [String:Any?]()
|
||||||
|
|
||||||
|
let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:]
|
||||||
|
return dictionary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -27,3 +27,4 @@ open class OuterComposite: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,4 +8,17 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public typealias OuterNumber = Double
|
open class OuterNumber: JSONEncodable {
|
||||||
|
|
||||||
|
|
||||||
|
public init() {}
|
||||||
|
|
||||||
|
// MARK: JSONEncodable
|
||||||
|
open func encodeToJSON() -> Any {
|
||||||
|
var nillableDictionary = [String:Any?]()
|
||||||
|
|
||||||
|
let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:]
|
||||||
|
return dictionary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -8,4 +8,17 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public typealias OuterString = String
|
open class OuterString: JSONEncodable {
|
||||||
|
|
||||||
|
|
||||||
|
public init() {}
|
||||||
|
|
||||||
|
// MARK: JSONEncodable
|
||||||
|
open func encodeToJSON() -> Any {
|
||||||
|
var nillableDictionary = [String:Any?]()
|
||||||
|
|
||||||
|
let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:]
|
||||||
|
return dictionary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -39,3 +39,4 @@ open class Pet: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class ReadOnlyFirst: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,3 +24,4 @@ open class Return: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class SpecialModelName: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class Tag: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,3 +38,4 @@ open class User: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ open class RequestBuilder<T> {
|
|||||||
|
|
||||||
open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: ErrorResponse?) -> Void) { }
|
open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: ErrorResponse?) -> Void) { }
|
||||||
|
|
||||||
public func addHeader(name: String, value: String) -> Self {
|
@discardableResult public func addHeader(name: String, value: String) -> Self {
|
||||||
if !value.isEmpty {
|
if !value.isEmpty {
|
||||||
headers[name] = value
|
headers[name] = value
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ class Decoders {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func decodeOptional<T: RawRepresentable, U: AnyObject where T.RawValue == U>(clazz: T, source: AnyObject) -> Decoded<T?> {
|
static func decodeOptional<T: RawRepresentable, U: AnyObject>(clazz: T, source: AnyObject) -> Decoded<T?> where T.RawValue == U {
|
||||||
if let value = source as? U {
|
if let value = source as? U {
|
||||||
if let enumValue = T.init(rawValue: value) {
|
if let enumValue = T.init(rawValue: value) {
|
||||||
return .success(enumValue)
|
return .success(enumValue)
|
||||||
@ -824,7 +824,7 @@ class Decoders {
|
|||||||
}
|
}
|
||||||
// Decoder for OuterBoolean
|
// Decoder for OuterBoolean
|
||||||
Decoders.addDecoder(clazz: OuterBoolean.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterBoolean> in
|
Decoders.addDecoder(clazz: OuterBoolean.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterBoolean> in
|
||||||
if let source = source as? Bool {
|
if let source = source as? OuterBoolean {
|
||||||
return .success(source)
|
return .success(source)
|
||||||
} else {
|
} else {
|
||||||
return .failure(.typeMismatch(expected: "Typealias OuterBoolean", actual: "\(source)"))
|
return .failure(.typeMismatch(expected: "Typealias OuterBoolean", actual: "\(source)"))
|
||||||
@ -864,7 +864,7 @@ class Decoders {
|
|||||||
}
|
}
|
||||||
// Decoder for OuterNumber
|
// Decoder for OuterNumber
|
||||||
Decoders.addDecoder(clazz: OuterNumber.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterNumber> in
|
Decoders.addDecoder(clazz: OuterNumber.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterNumber> in
|
||||||
if let source = source as? Double {
|
if let source = source as? OuterNumber {
|
||||||
return .success(source)
|
return .success(source)
|
||||||
} else {
|
} else {
|
||||||
return .failure(.typeMismatch(expected: "Typealias OuterNumber", actual: "\(source)"))
|
return .failure(.typeMismatch(expected: "Typealias OuterNumber", actual: "\(source)"))
|
||||||
@ -872,7 +872,7 @@ class Decoders {
|
|||||||
}
|
}
|
||||||
// Decoder for OuterString
|
// Decoder for OuterString
|
||||||
Decoders.addDecoder(clazz: OuterString.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterString> in
|
Decoders.addDecoder(clazz: OuterString.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterString> in
|
||||||
if let source = source as? String {
|
if let source = source as? OuterString {
|
||||||
return .success(source)
|
return .success(source)
|
||||||
} else {
|
} else {
|
||||||
return .failure(.typeMismatch(expected: "Typealias OuterString", actual: "\(source)"))
|
return .failure(.typeMismatch(expected: "Typealias OuterString", actual: "\(source)"))
|
||||||
|
@ -25,3 +25,4 @@ open class AdditionalPropertiesClass: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class Animal: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,3 +27,4 @@ open class ApiResponse: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class ArrayOfArrayOfNumberOnly: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class ArrayOfNumberOnly: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,3 +27,4 @@ open class ArrayTest: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,3 +34,4 @@ open class Capitalization: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class Cat: Animal {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class Category: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,3 +24,4 @@ open class ClassModel: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class Client: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class Dog: Animal {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,3 +33,4 @@ open class EnumArrays: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,3 +42,4 @@ open class EnumTest: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,3 +47,4 @@ open class FormatTest: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class HasOnlyReadOnly: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class List: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,3 +28,4 @@ open class MapTest: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,3 +27,4 @@ open class MixedPropertiesAndAdditionalPropertiesClass: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,3 +26,4 @@ open class Model200Response: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,3 +30,4 @@ open class Name: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class NumberOnly: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,3 +39,4 @@ open class Order: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,4 +8,17 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public typealias OuterBoolean = Bool
|
open class OuterBoolean: JSONEncodable {
|
||||||
|
|
||||||
|
|
||||||
|
public init() {}
|
||||||
|
|
||||||
|
// MARK: JSONEncodable
|
||||||
|
open func encodeToJSON() -> Any {
|
||||||
|
var nillableDictionary = [String:Any?]()
|
||||||
|
|
||||||
|
let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:]
|
||||||
|
return dictionary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -27,3 +27,4 @@ open class OuterComposite: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,4 +8,17 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public typealias OuterNumber = Double
|
open class OuterNumber: JSONEncodable {
|
||||||
|
|
||||||
|
|
||||||
|
public init() {}
|
||||||
|
|
||||||
|
// MARK: JSONEncodable
|
||||||
|
open func encodeToJSON() -> Any {
|
||||||
|
var nillableDictionary = [String:Any?]()
|
||||||
|
|
||||||
|
let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:]
|
||||||
|
return dictionary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -8,4 +8,17 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public typealias OuterString = String
|
open class OuterString: JSONEncodable {
|
||||||
|
|
||||||
|
|
||||||
|
public init() {}
|
||||||
|
|
||||||
|
// MARK: JSONEncodable
|
||||||
|
open func encodeToJSON() -> Any {
|
||||||
|
var nillableDictionary = [String:Any?]()
|
||||||
|
|
||||||
|
let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:]
|
||||||
|
return dictionary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -39,3 +39,4 @@ open class Pet: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class ReadOnlyFirst: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,3 +24,4 @@ open class Return: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@ open class SpecialModelName: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class Tag: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,3 +38,4 @@ open class User: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ open class RequestBuilder<T> {
|
|||||||
|
|
||||||
open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: ErrorResponse?) -> Void) { }
|
open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: ErrorResponse?) -> Void) { }
|
||||||
|
|
||||||
public func addHeader(name: String, value: String) -> Self {
|
@discardableResult public func addHeader(name: String, value: String) -> Self {
|
||||||
if !value.isEmpty {
|
if !value.isEmpty {
|
||||||
headers[name] = value
|
headers[name] = value
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ class Decoders {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func decodeOptional<T: RawRepresentable, U: AnyObject where T.RawValue == U>(clazz: T, source: AnyObject) -> Decoded<T?> {
|
static func decodeOptional<T: RawRepresentable, U: AnyObject>(clazz: T, source: AnyObject) -> Decoded<T?> where T.RawValue == U {
|
||||||
if let value = source as? U {
|
if let value = source as? U {
|
||||||
if let enumValue = T.init(rawValue: value) {
|
if let enumValue = T.init(rawValue: value) {
|
||||||
return .success(enumValue)
|
return .success(enumValue)
|
||||||
@ -712,7 +712,7 @@ class Decoders {
|
|||||||
}
|
}
|
||||||
// Decoder for OuterBoolean
|
// Decoder for OuterBoolean
|
||||||
Decoders.addDecoder(clazz: OuterBoolean.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterBoolean> in
|
Decoders.addDecoder(clazz: OuterBoolean.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterBoolean> in
|
||||||
if let source = source as? Bool {
|
if let source = source as? OuterBoolean {
|
||||||
return .success(source)
|
return .success(source)
|
||||||
} else {
|
} else {
|
||||||
return .failure(.typeMismatch(expected: "Typealias OuterBoolean", actual: "\(source)"))
|
return .failure(.typeMismatch(expected: "Typealias OuterBoolean", actual: "\(source)"))
|
||||||
@ -746,7 +746,7 @@ class Decoders {
|
|||||||
}
|
}
|
||||||
// Decoder for OuterNumber
|
// Decoder for OuterNumber
|
||||||
Decoders.addDecoder(clazz: OuterNumber.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterNumber> in
|
Decoders.addDecoder(clazz: OuterNumber.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterNumber> in
|
||||||
if let source = source as? Double {
|
if let source = source as? OuterNumber {
|
||||||
return .success(source)
|
return .success(source)
|
||||||
} else {
|
} else {
|
||||||
return .failure(.typeMismatch(expected: "Typealias OuterNumber", actual: "\(source)"))
|
return .failure(.typeMismatch(expected: "Typealias OuterNumber", actual: "\(source)"))
|
||||||
@ -754,7 +754,7 @@ class Decoders {
|
|||||||
}
|
}
|
||||||
// Decoder for OuterString
|
// Decoder for OuterString
|
||||||
Decoders.addDecoder(clazz: OuterString.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterString> in
|
Decoders.addDecoder(clazz: OuterString.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterString> in
|
||||||
if let source = source as? String {
|
if let source = source as? OuterString {
|
||||||
return .success(source)
|
return .success(source)
|
||||||
} else {
|
} else {
|
||||||
return .failure(.typeMismatch(expected: "Typealias OuterString", actual: "\(source)"))
|
return .failure(.typeMismatch(expected: "Typealias OuterString", actual: "\(source)"))
|
||||||
|
@ -28,3 +28,4 @@ open class AdditionalPropertiesClass: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,3 +28,4 @@ open class Animal: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,3 +31,4 @@ open class ApiResponse: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class ArrayOfArrayOfNumberOnly: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class ArrayOfNumberOnly: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,3 +31,4 @@ open class ArrayTest: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,3 +41,4 @@ open class Capitalization: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class Cat: Animal {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,3 +28,4 @@ open class Category: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,3 +26,4 @@ open class ClassModel: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class Client: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class Dog: Animal {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,3 +36,4 @@ open class EnumArrays: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,3 +47,4 @@ open class EnumTest: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,3 +61,4 @@ open class FormatTest: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,3 +28,4 @@ open class HasOnlyReadOnly: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class List: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,3 +31,4 @@ open class MapTest: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,3 +31,4 @@ open class MixedPropertiesAndAdditionalPropertiesClass: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,3 +29,4 @@ open class Model200Response: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,3 +35,4 @@ open class Name: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,3 +25,4 @@ open class NumberOnly: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,3 +46,4 @@ open class Order: JSONEncodable {
|
|||||||
return dictionary
|
return dictionary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,4 +8,18 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public typealias OuterBoolean = Bool
|
open class OuterBoolean: JSONEncodable {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public init() {
|
||||||
|
}
|
||||||
|
// MARK: JSONEncodable
|
||||||
|
open func encodeToJSON() -> Any {
|
||||||
|
var nillableDictionary = [String:Any?]()
|
||||||
|
|
||||||
|
let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:]
|
||||||
|
return dictionary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user