From 70a95e0247d72025b6cee9914077455f32b93fb6 Mon Sep 17 00:00:00 2001 From: Dan Woodel Date: Wed, 9 Aug 2017 19:46:38 +0100 Subject: [PATCH] [swift3] empty model with only additional properties --- .../src/main/resources/swift3/Models.mustache | 9 +- .../src/main/resources/swift3/model.mustache | 6 +- .../swift/.swagger-codegen/VERSION | 1 + .../swift/SwaggerClient.podspec | 4 +- .../Classes/Swaggers/Extensions.swift | 93 +++++++++++++++++++ .../Classes/Swaggers/Models.swift | 11 ++- .../Classes/Swaggers/Models.swift | 6 +- .../Models/AdditionalPropertiesClass.swift | 1 + .../Classes/Swaggers/Models/Animal.swift | 1 + .../Classes/Swaggers/Models/ApiResponse.swift | 1 + .../Models/ArrayOfArrayOfNumberOnly.swift | 1 + .../Swaggers/Models/ArrayOfNumberOnly.swift | 1 + .../Classes/Swaggers/Models/ArrayTest.swift | 1 + .../Swaggers/Models/Capitalization.swift | 1 + .../Classes/Swaggers/Models/Cat.swift | 1 + .../Classes/Swaggers/Models/Category.swift | 1 + .../Classes/Swaggers/Models/ClassModel.swift | 1 + .../Classes/Swaggers/Models/Client.swift | 1 + .../Classes/Swaggers/Models/Dog.swift | 1 + .../Classes/Swaggers/Models/EnumArrays.swift | 1 + .../Classes/Swaggers/Models/EnumTest.swift | 1 + .../Classes/Swaggers/Models/FormatTest.swift | 1 + .../Swaggers/Models/HasOnlyReadOnly.swift | 1 + .../Classes/Swaggers/Models/List.swift | 1 + .../Classes/Swaggers/Models/MapTest.swift | 1 + ...opertiesAndAdditionalPropertiesClass.swift | 1 + .../Swaggers/Models/Model200Response.swift | 1 + .../Classes/Swaggers/Models/Name.swift | 1 + .../Classes/Swaggers/Models/NumberOnly.swift | 1 + .../Classes/Swaggers/Models/Order.swift | 1 + .../Swaggers/Models/OuterBoolean.swift | 15 ++- .../Swaggers/Models/OuterComposite.swift | 1 + .../Classes/Swaggers/Models/OuterNumber.swift | 15 ++- .../Classes/Swaggers/Models/OuterString.swift | 15 ++- .../Classes/Swaggers/Models/Pet.swift | 1 + .../Swaggers/Models/ReadOnlyFirst.swift | 1 + .../Classes/Swaggers/Models/Return.swift | 1 + .../Swaggers/Models/SpecialModelName.swift | 1 + .../Classes/Swaggers/Models/Tag.swift | 1 + .../Classes/Swaggers/Models/User.swift | 1 + 40 files changed, 188 insertions(+), 17 deletions(-) create mode 100644 samples/client/petstore-security-test/swift/.swagger-codegen/VERSION diff --git a/modules/swagger-codegen/src/main/resources/swift3/Models.mustache b/modules/swagger-codegen/src/main/resources/swift3/Models.mustache index f8c312452e0..4b190fb8dfd 100644 --- a/modules/swagger-codegen/src/main/resources/swift3/Models.mustache +++ b/modules/swagger-codegen/src/main/resources/swift3/Models.mustache @@ -277,7 +277,7 @@ class Decoders { {{/isEnum}} {{^isEnum}} {{#allVars.isEmpty}} - if let source = source as? {{dataType}} { + if let source = source as? {{classname}} { return .success(source) } else { return .failure(.typeMismatch(expected: "Typealias {{classname}}", actual: "\(source)")) @@ -335,8 +335,11 @@ class Decoders { } for key in propsDictionary.keys { - if let decodedValue = Decoders.decodeOptional(clazz: String.self, source: propsDictionary[key] as AnyObject?) { - result[key] = decodedValue + switch Decoders.decodeOptional(clazz: String.self, source: propsDictionary[key] as AnyObject?) { + + case let .success(value): result[key] = value + default: continue + } } {{/additionalPropertiesType}} diff --git a/modules/swagger-codegen/src/main/resources/swift3/model.mustache b/modules/swagger-codegen/src/main/resources/swift3/model.mustache index 5e69c93b692..129ecc15275 100644 --- a/modules/swagger-codegen/src/main/resources/swift3/model.mustache +++ b/modules/swagger-codegen/src/main/resources/swift3/model.mustache @@ -24,10 +24,6 @@ public enum {{classname}}: {{dataType}} { } {{/isEnum}} {{^isEnum}} -{{#vars.isEmpty}} -public typealias {{classname}} = {{dataType}} -{{/vars.isEmpty}} -{{^vars.isEmpty}} open class {{classname}}: {{#parent}}{{{parent}}}{{/parent}}{{^parent}}JSONEncodable{{/parent}} { {{#vars}} @@ -102,7 +98,7 @@ open class {{classname}}: {{#parent}}{{{parent}}}{{/parent}}{{^parent}}JSONEncod return dictionary } } -{{/vars.isEmpty}} + {{/isEnum}} {{/isArrayModel}} {{/model}} diff --git a/samples/client/petstore-security-test/swift/.swagger-codegen/VERSION b/samples/client/petstore-security-test/swift/.swagger-codegen/VERSION new file mode 100644 index 00000000000..f9f7450d135 --- /dev/null +++ b/samples/client/petstore-security-test/swift/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore-security-test/swift/SwaggerClient.podspec b/samples/client/petstore-security-test/swift/SwaggerClient.podspec index e3b018276fd..f6faf03a57a 100644 --- a/samples/client/petstore-security-test/swift/SwaggerClient.podspec +++ b/samples/client/petstore-security-test/swift/SwaggerClient.podspec @@ -8,6 +8,6 @@ Pod::Spec.new do |s| s.license = 'Proprietary' s.homepage = 'https://github.com/swagger-api/swagger-codegen' s.summary = 'SwaggerClient Swift SDK' - s.source_files = 'SwaggerClient/Classes/Swaggers/**/*.swift' - s.dependency 'Alamofire', '~> 3.4.1' + s.source_files = 'SwaggerClient/Classes/**/*.swift' + s.dependency 'Alamofire', '~> 3.5.1' end diff --git a/samples/client/petstore-security-test/swift/SwaggerClient/Classes/Swaggers/Extensions.swift b/samples/client/petstore-security-test/swift/SwaggerClient/Classes/Swaggers/Extensions.swift index c974cc40b36..d14c7fc808c 100644 --- a/samples/client/petstore-security-test/swift/SwaggerClient/Classes/Swaggers/Extensions.swift +++ b/samples/client/petstore-security-test/swift/SwaggerClient/Classes/Swaggers/Extensions.swift @@ -83,4 +83,97 @@ extension NSUUID: JSONEncodable { } } +/// Represents an ISO-8601 full-date (RFC-3339). +/// ex: 12-31-1999 +/// https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14 +public final class ISOFullDate: CustomStringConvertible { + + public let year: Int + public let month: Int + public let day: Int + + public init(year year: Int, month: Int, day: Int) { + self.year = year + self.month = month + self.day = day + } + + /** + Converts an NSDate to an ISOFullDate. Only interested in the year, month, day components. + + - parameter date: The date to convert. + + - returns: An ISOFullDate constructed from the year, month, day of the date. + */ + public static func from(date date: NSDate) -> ISOFullDate? { + guard let calendar = NSCalendar(identifier: NSCalendarIdentifierGregorian) else { + return nil + } + + let components = calendar.components( + [ + .Year, + .Month, + .Day, + ], + fromDate: date + ) + return ISOFullDate( + year: components.year, + month: components.month, + day: components.day + ) + } + + /** + Converts a ISO-8601 full-date string to an ISOFullDate. + + - parameter string: The ISO-8601 full-date format string to convert. + + - returns: An ISOFullDate constructed from the string. + */ + public static func from(string string: String) -> ISOFullDate? { + let components = string + .characters + .split("-") + .map(String.init) + .flatMap { Int($0) } + guard components.count == 3 else { return nil } + + return ISOFullDate( + year: components[0], + month: components[1], + day: components[2] + ) + } + + /** + Converts the receiver to an NSDate, in the default time zone. + + - returns: An NSDate from the components of the receiver, in the default time zone. + */ + public func toDate() -> NSDate? { + let components = NSDateComponents() + components.year = year + components.month = month + components.day = day + components.timeZone = NSTimeZone.defaultTimeZone() + let calendar = NSCalendar(identifier: NSCalendarIdentifierGregorian) + return calendar?.dateFromComponents(components) + } + + // MARK: CustomStringConvertible + + public var description: String { + return "\(year)-\(month)-\(day)" + } + +} + +extension ISOFullDate: JSONEncodable { + public func encodeToJSON() -> AnyObject { + return "\(year)-\(month)-\(day)" + } +} + diff --git a/samples/client/petstore-security-test/swift/SwaggerClient/Classes/Swaggers/Models.swift b/samples/client/petstore-security-test/swift/SwaggerClient/Classes/Swaggers/Models.swift index 47aec6ef918..538fa082c8d 100644 --- a/samples/client/petstore-security-test/swift/SwaggerClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore-security-test/swift/SwaggerClient/Classes/Swaggers/Models.swift @@ -140,7 +140,16 @@ class Decoders { return NSDate(timeIntervalSince1970: Double(sourceInt / 1000) ) } fatalError("formatter failed to parse \(source)") - } + } + + // Decoder for ISOFullDate + Decoders.addDecoder(clazz: ISOFullDate.self, decoder: { (source: AnyObject) -> ISOFullDate in + if let string = source as? String, + let isoDate = ISOFullDate.from(string: string) { + return isoDate + } + fatalError("formatter failed to parse \(source)") + }) // Decoder for [Return] Decoders.addDecoder(clazz: [Return].self) { (source: AnyObject) -> [Return] in diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift index fa325a0e964..803de113649 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift @@ -824,7 +824,7 @@ class Decoders { } // Decoder for OuterBoolean Decoders.addDecoder(clazz: OuterBoolean.self) { (source: AnyObject, instance: AnyObject?) -> Decoded 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)")) @@ -864,7 +864,7 @@ class Decoders { } // Decoder for OuterNumber Decoders.addDecoder(clazz: OuterNumber.self) { (source: AnyObject, instance: AnyObject?) -> Decoded 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)")) @@ -872,7 +872,7 @@ class Decoders { } // Decoder for OuterString Decoders.addDecoder(clazz: OuterString.self) { (source: AnyObject, instance: AnyObject?) -> Decoded 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)")) diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift index 841becdb238..fe333aaafa7 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/AdditionalPropertiesClass.swift @@ -25,3 +25,4 @@ open class AdditionalPropertiesClass: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Animal.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Animal.swift index 057ab8e803e..f9fd0e865c0 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Animal.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Animal.swift @@ -25,3 +25,4 @@ open class Animal: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift index c95f95c7afa..cad05c5b6d6 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ApiResponse.swift @@ -27,3 +27,4 @@ open class ApiResponse: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift index f10815e4828..d7870d7c01f 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfArrayOfNumberOnly.swift @@ -23,3 +23,4 @@ open class ArrayOfArrayOfNumberOnly: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift index d8a77858c97..01d3b173384 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayOfNumberOnly.swift @@ -23,3 +23,4 @@ open class ArrayOfNumberOnly: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift index a46bb27cacb..ef7b15bccd0 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ArrayTest.swift @@ -27,3 +27,4 @@ open class ArrayTest: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift index 54707831d7a..6b7796e65e2 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Capitalization.swift @@ -34,3 +34,4 @@ open class Capitalization: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Cat.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Cat.swift index 6bfbfe267b5..910cd8119e0 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Cat.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Cat.swift @@ -23,3 +23,4 @@ open class Cat: Animal { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Category.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Category.swift index ed9bbc41ee0..ecc1b3b52d5 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Category.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Category.swift @@ -25,3 +25,4 @@ open class Category: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift index 33f610c373a..0423f522ed1 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ClassModel.swift @@ -24,3 +24,4 @@ open class ClassModel: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Client.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Client.swift index adbe50b416d..d7a70386702 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Client.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Client.swift @@ -23,3 +23,4 @@ open class Client: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Dog.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Dog.swift index 1df72ce1283..36ea9b97b68 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Dog.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Dog.swift @@ -23,3 +23,4 @@ open class Dog: Animal { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift index b54a5df9d76..9bfe63ce1d7 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumArrays.swift @@ -33,3 +33,4 @@ open class EnumArrays: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift index 4eb4f0f5842..ac5a3307532 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/EnumTest.swift @@ -42,3 +42,4 @@ open class EnumTest: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift index 1a3b2ef1134..e4c1a85dbd6 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift @@ -47,3 +47,4 @@ open class FormatTest: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift index 35de18afb7a..fc41604fc8f 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/HasOnlyReadOnly.swift @@ -25,3 +25,4 @@ open class HasOnlyReadOnly: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/List.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/List.swift index 03427b57091..bc30aa7469d 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/List.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/List.swift @@ -23,3 +23,4 @@ open class List: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MapTest.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MapTest.swift index d4fefbc417b..d2191dae660 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MapTest.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MapTest.swift @@ -28,3 +28,4 @@ open class MapTest: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index a738b2218e2..c5a588c833f 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -27,3 +27,4 @@ open class MixedPropertiesAndAdditionalPropertiesClass: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift index d31ca62f3b1..ad20a8344ba 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Model200Response.swift @@ -26,3 +26,4 @@ open class Model200Response: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Name.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Name.swift index 50430f5f45f..0a2a87ec568 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Name.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Name.swift @@ -30,3 +30,4 @@ open class Name: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift index 842cc740daf..54a0a97d978 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/NumberOnly.swift @@ -23,3 +23,4 @@ open class NumberOnly: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Order.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Order.swift index 3d43e79c92b..26e64adf612 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Order.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Order.swift @@ -39,3 +39,4 @@ open class Order: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterBoolean.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterBoolean.swift index 3c49ad29400..a24f9f6b14a 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterBoolean.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterBoolean.swift @@ -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 + } +} + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterComposite.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterComposite.swift index 7fc6d69391c..ddf86622451 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterComposite.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterComposite.swift @@ -27,3 +27,4 @@ open class OuterComposite: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterNumber.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterNumber.swift index f285f4e5e29..64d8da6440f 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterNumber.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterNumber.swift @@ -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 + } +} + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterString.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterString.swift index 9da794627d6..a6ea38c804b 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterString.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterString.swift @@ -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 + } +} + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Pet.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Pet.swift index 0492ac800f3..9930ae27dab 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Pet.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Pet.swift @@ -39,3 +39,4 @@ open class Pet: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift index 91d93e166b1..ca4945617a5 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/ReadOnlyFirst.swift @@ -25,3 +25,4 @@ open class ReadOnlyFirst: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Return.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Return.swift index dcffb177a6a..b0652f2d1b7 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Return.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Return.swift @@ -24,3 +24,4 @@ open class Return: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift index 86317fcc6f2..52fb9b1913c 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/SpecialModelName.swift @@ -23,3 +23,4 @@ open class SpecialModelName: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Tag.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Tag.swift index a66bc4b484f..eb865158c29 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Tag.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Tag.swift @@ -25,3 +25,4 @@ open class Tag: JSONEncodable { return dictionary } } + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/User.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/User.swift index ae54b81e80f..fc08160a904 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/User.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/User.swift @@ -38,3 +38,4 @@ open class User: JSONEncodable { return dictionary } } +