From 86a76370106cec190eb91dca1f4f52f97cccd050 Mon Sep 17 00:00:00 2001 From: Joseph Zuromski Date: Wed, 13 Apr 2016 23:36:16 -0700 Subject: [PATCH] [Swift] minor spacing cleanup in Models.mustache --- .../src/main/resources/swift/Models.mustache | 4 +- .../Classes/Swaggers/APIs/PetAPI.swift | 218 +++++++++--------- .../Classes/Swaggers/APIs/StoreAPI.swift | 102 ++++---- .../Classes/Swaggers/APIs/UserAPI.swift | 8 +- .../Classes/Swaggers/Models.swift | 65 +++--- .../Classes/Swaggers/Models/FormatTest.swift | 6 +- .../Swaggers/Models/InlineResponse200.swift | 12 +- 7 files changed, 209 insertions(+), 206 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/swift/Models.mustache b/modules/swagger-codegen/src/main/resources/swift/Models.mustache index 31cb4a2e219..795fdd3d5e7 100644 --- a/modules/swagger-codegen/src/main/resources/swift/Models.mustache +++ b/modules/swagger-codegen/src/main/resources/swift/Models.mustache @@ -130,11 +130,11 @@ class Decoders { fatalError("formatter failed to parse \(source)") } {{#models}}{{#model}} - // Decoder for [{{{classname}}}] + // Decoder for [{{{classname}}}] Decoders.addDecoder(clazz: [{{{classname}}}].self) { (source: AnyObject) -> [{{{classname}}}] in return Decoders.decode(clazz: [{{{classname}}}].self, source: source) } - // Decoder for {{{classname}}} + // Decoder for {{{classname}}} Decoders.addDecoder(clazz: {{{classname}}}.self) { (source: AnyObject) -> {{{classname}}} in let sourceDictionary = source as! [NSObject:AnyObject] let instance = {{classname}}(){{#vars}}{{#isEnum}} diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index 347ccf23554..e9b1ae0a638 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift @@ -207,20 +207,20 @@ public class PetAPI: APIBase { - OAuth: - type: oauth2 - name: petstore_auth - - examples: [{example=[ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + - examples: [{contentType=application/json, example=[ { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -} ], contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 doggie @@ -229,21 +229,21 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] - - examples: [{example=[ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], +}] + - examples: [{contentType=application/json, example=[ { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -} ], contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 doggie @@ -252,7 +252,7 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] +}] - parameter status: (query) Status values that need to be considered for query (optional, default to available) @@ -309,20 +309,20 @@ public class PetAPI: APIBase { - OAuth: - type: oauth2 - name: petstore_auth - - examples: [{example=[ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + - examples: [{contentType=application/json, example=[ { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -} ], contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 doggie @@ -331,21 +331,21 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] - - examples: [{example=[ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], +}] + - examples: [{contentType=application/json, example=[ { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -} ], contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 doggie @@ -354,7 +354,7 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] +}] - parameter tags: (query) Tags to filter by (optional) @@ -408,26 +408,26 @@ public class PetAPI: APIBase { Find pet by ID - GET /pet/{petId} - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - - API Key: - - type: apiKey api_key - - name: api_key - OAuth: - type: oauth2 - name: petstore_auth - - examples: [{example={ - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + - API Key: + - type: apiKey api_key + - name: api_key + - examples: [{contentType=application/json, example={ + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -}, contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 doggie @@ -436,21 +436,21 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] - - examples: [{example={ - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], +}] + - examples: [{contentType=application/json, example={ + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -}, contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 doggie @@ -459,7 +459,7 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] +}] - parameter petId: (path) ID of pet that needs to be fetched @@ -512,46 +512,46 @@ public class PetAPI: APIBase { Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - GET /pet/{petId}?response=inline_arbitrary_object - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - - API Key: - - type: apiKey api_key - - name: api_key - OAuth: - type: oauth2 - name: petstore_auth - - examples: [{example={ - "id" : 123456789, - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], - "category" : "{}", - "status" : "aeiou", + - API Key: + - type: apiKey api_key + - name: api_key + - examples: [{contentType=application/json, example={ + "photoUrls" : [ "aeiou" ], "name" : "doggie", - "photoUrls" : [ "aeiou" ] -}, contentType=application/json}, {example= + "id" : 123456789, + "category" : "{}", + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +}}, {contentType=application/xml, example= + string + doggie 123456 not implemented io.swagger.models.properties.ObjectProperty@37ff6855 string - doggie - string -, contentType=application/xml}] - - examples: [{example={ - "id" : 123456789, - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], - "category" : "{}", - "status" : "aeiou", +}] + - examples: [{contentType=application/json, example={ + "photoUrls" : [ "aeiou" ], "name" : "doggie", - "photoUrls" : [ "aeiou" ] -}, contentType=application/json}, {example= + "id" : 123456789, + "category" : "{}", + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +}}, {contentType=application/xml, example= + string + doggie 123456 not implemented io.swagger.models.properties.ObjectProperty@37ff6855 string - doggie - string -, contentType=application/xml}] +}] - parameter petId: (path) ID of pet that needs to be fetched @@ -604,14 +604,14 @@ public class PetAPI: APIBase { Fake endpoint to test byte array return by 'Find pet by ID' - GET /pet/{petId}?testing_byte_array=true - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - - API Key: - - type: apiKey api_key - - name: api_key - OAuth: - type: oauth2 - name: petstore_auth - - examples: [{example="", contentType=application/json}, {example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e, contentType=application/xml}] - - examples: [{example="", contentType=application/json}, {example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e, contentType=application/xml}] + - API Key: + - type: apiKey api_key + - name: api_key + - examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e}] + - examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e}] - parameter petId: (path) ID of pet that needs to be fetched diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift index 94c311f1a44..5a07798b7b6 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift @@ -103,36 +103,36 @@ public class StoreAPI: APIBase { - API Key: - type: apiKey x-test_api_client_secret - name: test_api_client_secret - - examples: [{example=[ { - "id" : 123456789, + - examples: [{contentType=application/json, example=[ { "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -} ], contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] - - examples: [{example=[ { - "id" : 123456789, +}] + - examples: [{contentType=application/json, example=[ { "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -} ], contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] +}] - parameter status: (query) Status value that needs to be considered for query (optional, default to placed) @@ -187,12 +187,12 @@ public class StoreAPI: APIBase { - API Key: - type: apiKey api_key - name: api_key - - examples: [{example={ + - examples: [{contentType=application/json, example={ "key" : 123 -}, contentType=application/json}, {example=not implemented io.swagger.models.properties.MapProperty@d1e580af, contentType=application/xml}] - - examples: [{example={ +}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@d1e580af}] + - examples: [{contentType=application/json, example={ "key" : 123 -}, contentType=application/json}, {example=not implemented io.swagger.models.properties.MapProperty@d1e580af, contentType=application/xml}] +}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@d1e580af}] - returns: RequestBuilder<[String:Int32]> */ @@ -243,8 +243,8 @@ public class StoreAPI: APIBase { - API Key: - type: apiKey api_key - name: api_key - - examples: [{example="{}", contentType=application/json}, {example=not implemented io.swagger.models.properties.ObjectProperty@37aadb4f, contentType=application/xml}] - - examples: [{example="{}", contentType=application/json}, {example=not implemented io.swagger.models.properties.ObjectProperty@37aadb4f, contentType=application/xml}] + - examples: [{contentType=application/json, example="{}"}, {contentType=application/xml, example=not implemented io.swagger.models.properties.ObjectProperty@37aadb4f}] + - examples: [{contentType=application/json, example="{}"}, {contentType=application/xml, example=not implemented io.swagger.models.properties.ObjectProperty@37aadb4f}] - returns: RequestBuilder */ @@ -294,42 +294,42 @@ public class StoreAPI: APIBase { Find purchase order by ID - GET /store/order/{orderId} - For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - - API Key: - - type: apiKey test_api_key_header - - name: test_api_key_header - API Key: - type: apiKey test_api_key_query (QUERY) - name: test_api_key_query - - examples: [{example={ - "id" : 123456789, + - API Key: + - type: apiKey test_api_key_header + - name: test_api_key_header + - examples: [{contentType=application/json, example={ "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -}, contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] - - examples: [{example={ - "id" : 123456789, +}] + - examples: [{contentType=application/json, example={ "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -}, contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] +}] - parameter orderId: (path) ID of pet that needs to be fetched @@ -388,36 +388,36 @@ public class StoreAPI: APIBase { - API Key: - type: apiKey x-test_api_client_secret - name: test_api_client_secret - - examples: [{example={ - "id" : 123456789, + - examples: [{contentType=application/json, example={ "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -}, contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] - - examples: [{example={ - "id" : 123456789, +}] + - examples: [{contentType=application/json, example={ "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -}, contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] +}] - parameter body: (body) order placed for purchasing the pet (optional) diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift index 4f1f36754c6..6d917870801 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift @@ -247,7 +247,7 @@ public class UserAPI: APIBase { Get user by user name - GET /user/{username} - - - examples: [{example={ + - examples: [{contentType=application/json, example={ "id" : 1, "username" : "johnp", "firstName" : "John", @@ -256,7 +256,7 @@ public class UserAPI: APIBase { "password" : "-secret-", "phone" : "0123456789", "userStatus" : 0 -}, contentType=application/json}] +}}] - parameter username: (path) The name that needs to be fetched. Use user1 for testing. @@ -311,8 +311,8 @@ public class UserAPI: APIBase { Logs user into the system - GET /user/login - - - examples: [{example="aeiou", contentType=application/json}, {example=string, contentType=application/xml}] - - examples: [{example="aeiou", contentType=application/json}, {example=string, contentType=application/xml}] + - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}] + - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}] - parameter username: (query) The user name for login (optional) - parameter password: (query) The password for login in clear text (optional) diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift index bb8e7a7be4c..3d3710ea223 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift @@ -130,11 +130,11 @@ class Decoders { fatalError("formatter failed to parse \(source)") } - // Decoder for [Animal] + // Decoder for [Animal] Decoders.addDecoder(clazz: [Animal].self) { (source: AnyObject) -> [Animal] in return Decoders.decode(clazz: [Animal].self, source: source) } - // Decoder for Animal + // Decoder for Animal Decoders.addDecoder(clazz: Animal.self) { (source: AnyObject) -> Animal in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Animal() @@ -143,11 +143,11 @@ class Decoders { } - // Decoder for [Cat] + // Decoder for [Cat] Decoders.addDecoder(clazz: [Cat].self) { (source: AnyObject) -> [Cat] in return Decoders.decode(clazz: [Cat].self, source: source) } - // Decoder for Cat + // Decoder for Cat Decoders.addDecoder(clazz: Cat.self) { (source: AnyObject) -> Cat in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Cat() @@ -157,11 +157,11 @@ class Decoders { } - // Decoder for [Category] + // Decoder for [Category] Decoders.addDecoder(clazz: [Category].self) { (source: AnyObject) -> [Category] in return Decoders.decode(clazz: [Category].self, source: source) } - // Decoder for Category + // Decoder for Category Decoders.addDecoder(clazz: Category.self) { (source: AnyObject) -> Category in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Category() @@ -171,11 +171,11 @@ class Decoders { } - // Decoder for [Dog] + // Decoder for [Dog] Decoders.addDecoder(clazz: [Dog].self) { (source: AnyObject) -> [Dog] in return Decoders.decode(clazz: [Dog].self, source: source) } - // Decoder for Dog + // Decoder for Dog Decoders.addDecoder(clazz: Dog.self) { (source: AnyObject) -> Dog in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Dog() @@ -185,11 +185,11 @@ class Decoders { } - // Decoder for [FormatTest] + // Decoder for [FormatTest] Decoders.addDecoder(clazz: [FormatTest].self) { (source: AnyObject) -> [FormatTest] in return Decoders.decode(clazz: [FormatTest].self, source: source) } - // Decoder for FormatTest + // Decoder for FormatTest Decoders.addDecoder(clazz: FormatTest.self) { (source: AnyObject) -> FormatTest in let sourceDictionary = source as! [NSObject:AnyObject] let instance = FormatTest() @@ -203,34 +203,35 @@ class Decoders { instance.byte = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["byte"]) instance.binary = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["binary"]) instance.date = Decoders.decodeOptional(clazz: NSDate.self, source: sourceDictionary["date"]) - instance.dateTime = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["dateTime"]) + instance.dateTime = Decoders.decodeOptional(clazz: NSDate.self, source: sourceDictionary["dateTime"]) + instance.password = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["password"]) return instance } - // Decoder for [InlineResponse200] + // Decoder for [InlineResponse200] Decoders.addDecoder(clazz: [InlineResponse200].self) { (source: AnyObject) -> [InlineResponse200] in return Decoders.decode(clazz: [InlineResponse200].self, source: source) } - // Decoder for InlineResponse200 + // Decoder for InlineResponse200 Decoders.addDecoder(clazz: InlineResponse200.self) { (source: AnyObject) -> InlineResponse200 in let sourceDictionary = source as! [NSObject:AnyObject] let instance = InlineResponse200() - instance.tags = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["tags"]) + instance.photoUrls = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["photoUrls"]) + instance.name = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"]) instance.id = Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"]) instance.category = Decoders.decodeOptional(clazz: AnyObject.self, source: sourceDictionary["category"]) + instance.tags = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["tags"]) instance.status = InlineResponse200.Status(rawValue: (sourceDictionary["status"] as? String) ?? "") - instance.name = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"]) - instance.photoUrls = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["photoUrls"]) return instance } - // Decoder for [Model200Response] + // Decoder for [Model200Response] Decoders.addDecoder(clazz: [Model200Response].self) { (source: AnyObject) -> [Model200Response] in return Decoders.decode(clazz: [Model200Response].self, source: source) } - // Decoder for Model200Response + // Decoder for Model200Response Decoders.addDecoder(clazz: Model200Response.self) { (source: AnyObject) -> Model200Response in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Model200Response() @@ -239,11 +240,11 @@ class Decoders { } - // Decoder for [ModelReturn] + // Decoder for [ModelReturn] Decoders.addDecoder(clazz: [ModelReturn].self) { (source: AnyObject) -> [ModelReturn] in return Decoders.decode(clazz: [ModelReturn].self, source: source) } - // Decoder for ModelReturn + // Decoder for ModelReturn Decoders.addDecoder(clazz: ModelReturn.self) { (source: AnyObject) -> ModelReturn in let sourceDictionary = source as! [NSObject:AnyObject] let instance = ModelReturn() @@ -252,11 +253,11 @@ class Decoders { } - // Decoder for [Name] + // Decoder for [Name] Decoders.addDecoder(clazz: [Name].self) { (source: AnyObject) -> [Name] in return Decoders.decode(clazz: [Name].self, source: source) } - // Decoder for Name + // Decoder for Name Decoders.addDecoder(clazz: Name.self) { (source: AnyObject) -> Name in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Name() @@ -266,11 +267,11 @@ class Decoders { } - // Decoder for [Order] + // Decoder for [Order] Decoders.addDecoder(clazz: [Order].self) { (source: AnyObject) -> [Order] in return Decoders.decode(clazz: [Order].self, source: source) } - // Decoder for Order + // Decoder for Order Decoders.addDecoder(clazz: Order.self) { (source: AnyObject) -> Order in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Order() @@ -284,11 +285,11 @@ class Decoders { } - // Decoder for [Pet] + // Decoder for [Pet] Decoders.addDecoder(clazz: [Pet].self) { (source: AnyObject) -> [Pet] in return Decoders.decode(clazz: [Pet].self, source: source) } - // Decoder for Pet + // Decoder for Pet Decoders.addDecoder(clazz: Pet.self) { (source: AnyObject) -> Pet in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Pet() @@ -302,11 +303,11 @@ class Decoders { } - // Decoder for [SpecialModelName] + // Decoder for [SpecialModelName] Decoders.addDecoder(clazz: [SpecialModelName].self) { (source: AnyObject) -> [SpecialModelName] in return Decoders.decode(clazz: [SpecialModelName].self, source: source) } - // Decoder for SpecialModelName + // Decoder for SpecialModelName Decoders.addDecoder(clazz: SpecialModelName.self) { (source: AnyObject) -> SpecialModelName in let sourceDictionary = source as! [NSObject:AnyObject] let instance = SpecialModelName() @@ -315,11 +316,11 @@ class Decoders { } - // Decoder for [Tag] + // Decoder for [Tag] Decoders.addDecoder(clazz: [Tag].self) { (source: AnyObject) -> [Tag] in return Decoders.decode(clazz: [Tag].self, source: source) } - // Decoder for Tag + // Decoder for Tag Decoders.addDecoder(clazz: Tag.self) { (source: AnyObject) -> Tag in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Tag() @@ -329,11 +330,11 @@ class Decoders { } - // Decoder for [User] + // Decoder for [User] Decoders.addDecoder(clazz: [User].self) { (source: AnyObject) -> [User] in return Decoders.decode(clazz: [User].self, source: source) } - // Decoder for User + // Decoder for User Decoders.addDecoder(clazz: User.self) { (source: AnyObject) -> User in let sourceDictionary = source as! [NSObject:AnyObject] let instance = User() diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift index ee2547d3e89..b84000125e3 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift @@ -19,7 +19,8 @@ public class FormatTest: JSONEncodable { public var byte: String? public var binary: String? public var date: NSDate? - public var dateTime: String? + public var dateTime: NSDate? + public var password: String? public init() {} @@ -37,7 +38,8 @@ public class FormatTest: JSONEncodable { nillableDictionary["byte"] = self.byte nillableDictionary["binary"] = self.binary nillableDictionary["date"] = self.date?.encodeToJSON() - nillableDictionary["dateTime"] = self.dateTime + nillableDictionary["dateTime"] = self.dateTime?.encodeToJSON() + nillableDictionary["password"] = self.password let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/InlineResponse200.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/InlineResponse200.swift index 6e3ce5aeaba..a9397e868ba 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/InlineResponse200.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/InlineResponse200.swift @@ -14,26 +14,26 @@ public class InlineResponse200: JSONEncodable { case Pending = "pending" case Sold = "sold" } - public var tags: [Tag]? + public var photoUrls: [String]? + public var name: String? public var id: Int64? public var category: AnyObject? + public var tags: [Tag]? /** pet status in the store */ public var status: Status? - public var name: String? - public var photoUrls: [String]? public init() {} // MARK: JSONEncodable func encodeToJSON() -> AnyObject { var nillableDictionary = [String:AnyObject?]() - nillableDictionary["tags"] = self.tags?.encodeToJSON() + nillableDictionary["photoUrls"] = self.photoUrls?.encodeToJSON() + nillableDictionary["name"] = self.name nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["category"] = self.category + nillableDictionary["tags"] = self.tags?.encodeToJSON() nillableDictionary["status"] = self.status?.rawValue - nillableDictionary["name"] = self.name - nillableDictionary["photoUrls"] = self.photoUrls?.encodeToJSON() let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary }