Skip to content

Commit

Permalink
Swift3 xcodewarnings (swagger-api#6298)
Browse files Browse the repository at this point in the history
* added headers to makeRequest function for swift3 template

* Swift3 update to dismiss Xcode warnings
  • Loading branch information
Ahmet Taha Sakar authored and wing328 committed Aug 13, 2017
1 parent 71123e1 commit da4fe86
Show file tree
Hide file tree
Showing 109 changed files with 238 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ open class RequestBuilder<T> {
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 {
headers[name] = value
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 enumValue = T.init(rawValue: value) {
return .success(enumValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ open class RequestBuilder<T> {

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 {
headers[name] = value
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 enumValue = T.init(rawValue: value) {
return .success(enumValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ open class RequestBuilder<T> {

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 {
headers[name] = value
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 enumValue = T.init(rawValue: value) {
return .success(enumValue)
Expand Down Expand Up @@ -824,7 +824,7 @@ class Decoders {
}
// Decoder for OuterBoolean
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)
} else {
return .failure(.typeMismatch(expected: "Typealias OuterBoolean", actual: "\(source)"))
Expand Down Expand Up @@ -864,15 +864,15 @@ class Decoders {
}
// Decoder for OuterNumber
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)
} else {
return .failure(.typeMismatch(expected: "Typealias OuterNumber", actual: "\(source)"))
}
}
// Decoder for OuterString
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)
} else {
return .failure(.typeMismatch(expected: "Typealias OuterString", actual: "\(source)"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ open class AdditionalPropertiesClass: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ open class Animal: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ open class ApiResponse: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ open class ArrayOfArrayOfNumberOnly: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ open class ArrayOfNumberOnly: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ open class ArrayTest: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ open class Capitalization: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ open class Cat: Animal {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ open class Category: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ open class ClassModel: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ open class Client: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ open class Dog: Animal {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ open class EnumArrays: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ open class EnumTest: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ open class FormatTest: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ open class HasOnlyReadOnly: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ open class List: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ open class MapTest: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ open class MixedPropertiesAndAdditionalPropertiesClass: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ open class Model200Response: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ open class Name: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ open class NumberOnly: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ open class Order: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,17 @@
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
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ open class OuterComposite: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,17 @@
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
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,17 @@
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
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ open class Pet: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ open class ReadOnlyFirst: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ open class Return: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ open class SpecialModelName: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ open class Tag: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ open class User: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ open class RequestBuilder<T> {

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 {
headers[name] = value
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 enumValue = T.init(rawValue: value) {
return .success(enumValue)
Expand Down Expand Up @@ -824,7 +824,7 @@ class Decoders {
}
// Decoder for OuterBoolean
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)
} else {
return .failure(.typeMismatch(expected: "Typealias OuterBoolean", actual: "\(source)"))
Expand Down Expand Up @@ -864,15 +864,15 @@ class Decoders {
}
// Decoder for OuterNumber
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)
} else {
return .failure(.typeMismatch(expected: "Typealias OuterNumber", actual: "\(source)"))
}
}
// Decoder for OuterString
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)
} else {
return .failure(.typeMismatch(expected: "Typealias OuterString", actual: "\(source)"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ open class AdditionalPropertiesClass: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ open class Animal: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ open class ApiResponse: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ open class ArrayOfArrayOfNumberOnly: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ open class ArrayOfNumberOnly: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ open class ArrayTest: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ open class Capitalization: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ open class Cat: Animal {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ open class Category: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ open class ClassModel: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ open class Client: JSONEncodable {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ open class Dog: Animal {
return dictionary
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ open class EnumArrays: JSONEncodable {
return dictionary
}
}

Loading

0 comments on commit da4fe86

Please sign in to comment.