Merge pull request #2417 from cjolif/int64

Generates Int32/Int64 for Swift when those are the required formats. …
This commit is contained in:
wing328 2016-04-09 16:38:10 +08:00
commit 27afadbc6d
20 changed files with 282 additions and 245 deletions

View File

@ -74,6 +74,8 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
languageSpecificPrimitives = new HashSet<String>( languageSpecificPrimitives = new HashSet<String>(
Arrays.asList( Arrays.asList(
"Int", "Int",
"Int32",
"Int64",
"Float", "Float",
"Double", "Double",
"Bool", "Bool",
@ -115,10 +117,10 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
typeMapping.put("string", "String"); typeMapping.put("string", "String");
typeMapping.put("char", "Character"); typeMapping.put("char", "Character");
typeMapping.put("short", "Int"); typeMapping.put("short", "Int");
typeMapping.put("int", "Int"); typeMapping.put("int", "Int32");
typeMapping.put("long", "Int"); typeMapping.put("long", "Int64");
typeMapping.put("integer", "Int"); typeMapping.put("integer", "Int32");
typeMapping.put("Integer", "Int"); typeMapping.put("Integer", "Int32");
typeMapping.put("float", "Float"); typeMapping.put("float", "Float");
typeMapping.put("number", "Double"); typeMapping.put("number", "Double");
typeMapping.put("double", "Double"); typeMapping.put("double", "Double");

View File

@ -19,6 +19,14 @@ extension Int: JSONEncodable {
func encodeToJSON() -> AnyObject { return self } func encodeToJSON() -> AnyObject { return self }
} }
extension Int32: JSONEncodable {
func encodeToJSON() -> AnyObject { return NSNumber(int: self) }
}
extension Int64: JSONEncodable {
func encodeToJSON() -> AnyObject { return NSNumber(longLong: self) }
}
extension Double: JSONEncodable { extension Double: JSONEncodable {
func encodeToJSON() -> AnyObject { return self } func encodeToJSON() -> AnyObject { return self }
} }

View File

@ -56,6 +56,12 @@ class Decoders {
static func decode<T>(clazz clazz: T.Type, source: AnyObject) -> T { static func decode<T>(clazz clazz: T.Type, source: AnyObject) -> T {
initialize() initialize()
if T.self is Int32.Type && source is NSNumber {
return source.intValue as! T;
}
if T.self is Int64.Type && source is NSNumber {
return source.longLongValue as! T;
}
if source is T { if source is T {
return source as! T return source as! T
} }

View File

@ -25,8 +25,10 @@ public class {{classname}}: JSONEncodable {
// MARK: JSONEncodable // MARK: JSONEncodable
func encodeToJSON() -> AnyObject { func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?](){{#vars}}{{#isNotContainer}}{{#isPrimitiveType}}{{^isEnum}} var nillableDictionary = [String:AnyObject?](){{#vars}}{{#isNotContainer}}{{#isPrimitiveType}}{{^isEnum}}{{#isInteger}}
nillableDictionary["{{baseName}}"] = self.{{name}}{{/isEnum}}{{/isPrimitiveType}}{{#isEnum}} nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.encodeToJSON(){{/isInteger}}{{#isLong}}
nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.encodeToJSON(){{/isLong}}{{^isLong}}{{^isInteger}}
nillableDictionary["{{baseName}}"] = self.{{name}}{{/isInteger}}{{/isLong}}{{/isEnum}}{{/isPrimitiveType}}{{#isEnum}}
nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.rawValue{{/isEnum}}{{^isPrimitiveType}} nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.rawValue{{/isEnum}}{{^isPrimitiveType}}
nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.encodeToJSON(){{/isPrimitiveType}}{{/isNotContainer}}{{#isContainer}} nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.encodeToJSON(){{/isPrimitiveType}}{{/isNotContainer}}{{#isContainer}}
nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.encodeToJSON(){{/isContainer}}{{/vars}} nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.encodeToJSON(){{/isContainer}}{{/vars}}

View File

@ -132,7 +132,7 @@ public class PetAPI: APIBase {
- parameter petId: (path) Pet id to delete - parameter petId: (path) Pet id to delete
- parameter completion: completion handler to receive the data and the error objects - parameter completion: completion handler to receive the data and the error objects
*/ */
public class func deletePet(petId petId: Int, completion: ((error: ErrorType?) -> Void)) { public class func deletePet(petId petId: Int64, completion: ((error: ErrorType?) -> Void)) {
deletePetWithRequestBuilder(petId: petId).execute { (response, error) -> Void in deletePetWithRequestBuilder(petId: petId).execute { (response, error) -> Void in
completion(error: error); completion(error: error);
} }
@ -145,7 +145,7 @@ public class PetAPI: APIBase {
- parameter petId: (path) Pet id to delete - parameter petId: (path) Pet id to delete
- returns: Promise<Void> - returns: Promise<Void>
*/ */
public class func deletePet(petId petId: Int) -> Promise<Void> { public class func deletePet(petId petId: Int64) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise() let deferred = Promise<Void>.pendingPromise()
deletePet(petId: petId) { error in deletePet(petId: petId) { error in
if let error = error { if let error = error {
@ -171,7 +171,7 @@ public class PetAPI: APIBase {
- returns: RequestBuilder<Void> - returns: RequestBuilder<Void>
*/ */
public class func deletePetWithRequestBuilder(petId petId: Int) -> RequestBuilder<Void> { public class func deletePetWithRequestBuilder(petId petId: Int64) -> RequestBuilder<Void> {
var path = "/pet/{petId}" var path = "/pet/{petId}"
path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil) path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path let URLString = PetstoreClientAPI.basePath + path
@ -225,20 +225,20 @@ public class PetAPI: APIBase {
- OAuth: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth
- examples: [{example=[ { - examples: [{contentType=application/json, example=[ {
"tags" : [ { "photoUrls" : [ "aeiou" ],
"id" : 123456789, "name" : "doggie",
"name" : "aeiou"
} ],
"id" : 123456789, "id" : 123456789,
"category" : { "category" : {
"id" : 123456789, "name" : "aeiou",
"name" : "aeiou" "id" : 123456789
}, },
"status" : "aeiou", "tags" : [ {
"name" : "doggie", "name" : "aeiou",
"photoUrls" : [ "aeiou" ] "id" : 123456789
} ], contentType=application/json}, {example=<Pet> } ],
"status" : "aeiou"
} ]}, {contentType=application/xml, example=<Pet>
<id>123456</id> <id>123456</id>
<name>doggie</name> <name>doggie</name>
<photoUrls> <photoUrls>
@ -247,21 +247,21 @@ public class PetAPI: APIBase {
<tags> <tags>
</tags> </tags>
<status>string</status> <status>string</status>
</Pet>, contentType=application/xml}] </Pet>}]
- examples: [{example=[ { - examples: [{contentType=application/json, example=[ {
"tags" : [ { "photoUrls" : [ "aeiou" ],
"id" : 123456789, "name" : "doggie",
"name" : "aeiou"
} ],
"id" : 123456789, "id" : 123456789,
"category" : { "category" : {
"id" : 123456789, "name" : "aeiou",
"name" : "aeiou" "id" : 123456789
}, },
"status" : "aeiou", "tags" : [ {
"name" : "doggie", "name" : "aeiou",
"photoUrls" : [ "aeiou" ] "id" : 123456789
} ], contentType=application/json}, {example=<Pet> } ],
"status" : "aeiou"
} ]}, {contentType=application/xml, example=<Pet>
<id>123456</id> <id>123456</id>
<name>doggie</name> <name>doggie</name>
<photoUrls> <photoUrls>
@ -270,7 +270,7 @@ public class PetAPI: APIBase {
<tags> <tags>
</tags> </tags>
<status>string</status> <status>string</status>
</Pet>, contentType=application/xml}] </Pet>}]
- parameter status: (query) Status values that need to be considered for query (optional, default to available) - parameter status: (query) Status values that need to be considered for query (optional, default to available)
@ -331,20 +331,20 @@ public class PetAPI: APIBase {
- OAuth: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth
- examples: [{example=[ { - examples: [{contentType=application/json, example=[ {
"tags" : [ { "photoUrls" : [ "aeiou" ],
"id" : 123456789, "name" : "doggie",
"name" : "aeiou"
} ],
"id" : 123456789, "id" : 123456789,
"category" : { "category" : {
"id" : 123456789, "name" : "aeiou",
"name" : "aeiou" "id" : 123456789
}, },
"status" : "aeiou", "tags" : [ {
"name" : "doggie", "name" : "aeiou",
"photoUrls" : [ "aeiou" ] "id" : 123456789
} ], contentType=application/json}, {example=<Pet> } ],
"status" : "aeiou"
} ]}, {contentType=application/xml, example=<Pet>
<id>123456</id> <id>123456</id>
<name>doggie</name> <name>doggie</name>
<photoUrls> <photoUrls>
@ -353,21 +353,21 @@ public class PetAPI: APIBase {
<tags> <tags>
</tags> </tags>
<status>string</status> <status>string</status>
</Pet>, contentType=application/xml}] </Pet>}]
- examples: [{example=[ { - examples: [{contentType=application/json, example=[ {
"tags" : [ { "photoUrls" : [ "aeiou" ],
"id" : 123456789, "name" : "doggie",
"name" : "aeiou"
} ],
"id" : 123456789, "id" : 123456789,
"category" : { "category" : {
"id" : 123456789, "name" : "aeiou",
"name" : "aeiou" "id" : 123456789
}, },
"status" : "aeiou", "tags" : [ {
"name" : "doggie", "name" : "aeiou",
"photoUrls" : [ "aeiou" ] "id" : 123456789
} ], contentType=application/json}, {example=<Pet> } ],
"status" : "aeiou"
} ]}, {contentType=application/xml, example=<Pet>
<id>123456</id> <id>123456</id>
<name>doggie</name> <name>doggie</name>
<photoUrls> <photoUrls>
@ -376,7 +376,7 @@ public class PetAPI: APIBase {
<tags> <tags>
</tags> </tags>
<status>string</status> <status>string</status>
</Pet>, contentType=application/xml}] </Pet>}]
- parameter tags: (query) Tags to filter by (optional) - parameter tags: (query) Tags to filter by (optional)
@ -403,7 +403,7 @@ public class PetAPI: APIBase {
- parameter petId: (path) ID of pet that needs to be fetched - parameter petId: (path) ID of pet that needs to be fetched
- parameter completion: completion handler to receive the data and the error objects - parameter completion: completion handler to receive the data and the error objects
*/ */
public class func getPetById(petId petId: Int, completion: ((data: Pet?, error: ErrorType?) -> Void)) { public class func getPetById(petId petId: Int64, completion: ((data: Pet?, error: ErrorType?) -> Void)) {
getPetByIdWithRequestBuilder(petId: petId).execute { (response, error) -> Void in getPetByIdWithRequestBuilder(petId: petId).execute { (response, error) -> Void in
completion(data: response?.body, error: error); completion(data: response?.body, error: error);
} }
@ -416,7 +416,7 @@ public class PetAPI: APIBase {
- parameter petId: (path) ID of pet that needs to be fetched - parameter petId: (path) ID of pet that needs to be fetched
- returns: Promise<Pet> - returns: Promise<Pet>
*/ */
public class func getPetById(petId petId: Int) -> Promise<Pet> { public class func getPetById(petId petId: Int64) -> Promise<Pet> {
let deferred = Promise<Pet>.pendingPromise() let deferred = Promise<Pet>.pendingPromise()
getPetById(petId: petId) { data, error in getPetById(petId: petId) { data, error in
if let error = error { if let error = error {
@ -434,26 +434,26 @@ public class PetAPI: APIBase {
- GET /pet/{petId} - GET /pet/{petId}
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - 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: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth
- examples: [{example={ - API Key:
"tags" : [ { - type: apiKey api_key
"id" : 123456789, - name: api_key
"name" : "aeiou" - examples: [{contentType=application/json, example={
} ], "photoUrls" : [ "aeiou" ],
"name" : "doggie",
"id" : 123456789, "id" : 123456789,
"category" : { "category" : {
"id" : 123456789, "name" : "aeiou",
"name" : "aeiou" "id" : 123456789
}, },
"status" : "aeiou", "tags" : [ {
"name" : "doggie", "name" : "aeiou",
"photoUrls" : [ "aeiou" ] "id" : 123456789
}, contentType=application/json}, {example=<Pet> } ],
"status" : "aeiou"
}}, {contentType=application/xml, example=<Pet>
<id>123456</id> <id>123456</id>
<name>doggie</name> <name>doggie</name>
<photoUrls> <photoUrls>
@ -462,21 +462,21 @@ public class PetAPI: APIBase {
<tags> <tags>
</tags> </tags>
<status>string</status> <status>string</status>
</Pet>, contentType=application/xml}] </Pet>}]
- examples: [{example={ - examples: [{contentType=application/json, example={
"tags" : [ { "photoUrls" : [ "aeiou" ],
"id" : 123456789, "name" : "doggie",
"name" : "aeiou"
} ],
"id" : 123456789, "id" : 123456789,
"category" : { "category" : {
"id" : 123456789, "name" : "aeiou",
"name" : "aeiou" "id" : 123456789
}, },
"status" : "aeiou", "tags" : [ {
"name" : "doggie", "name" : "aeiou",
"photoUrls" : [ "aeiou" ] "id" : 123456789
}, contentType=application/json}, {example=<Pet> } ],
"status" : "aeiou"
}}, {contentType=application/xml, example=<Pet>
<id>123456</id> <id>123456</id>
<name>doggie</name> <name>doggie</name>
<photoUrls> <photoUrls>
@ -485,13 +485,13 @@ public class PetAPI: APIBase {
<tags> <tags>
</tags> </tags>
<status>string</status> <status>string</status>
</Pet>, contentType=application/xml}] </Pet>}]
- parameter petId: (path) ID of pet that needs to be fetched - parameter petId: (path) ID of pet that needs to be fetched
- returns: RequestBuilder<Pet> - returns: RequestBuilder<Pet>
*/ */
public class func getPetByIdWithRequestBuilder(petId petId: Int) -> RequestBuilder<Pet> { public class func getPetByIdWithRequestBuilder(petId petId: Int64) -> RequestBuilder<Pet> {
var path = "/pet/{petId}" var path = "/pet/{petId}"
path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil) path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path let URLString = PetstoreClientAPI.basePath + path
@ -511,7 +511,7 @@ public class PetAPI: APIBase {
- parameter petId: (path) ID of pet that needs to be fetched - parameter petId: (path) ID of pet that needs to be fetched
- parameter completion: completion handler to receive the data and the error objects - parameter completion: completion handler to receive the data and the error objects
*/ */
public class func getPetByIdInObject(petId petId: Int, completion: ((data: InlineResponse200?, error: ErrorType?) -> Void)) { public class func getPetByIdInObject(petId petId: Int64, completion: ((data: InlineResponse200?, error: ErrorType?) -> Void)) {
getPetByIdInObjectWithRequestBuilder(petId: petId).execute { (response, error) -> Void in getPetByIdInObjectWithRequestBuilder(petId: petId).execute { (response, error) -> Void in
completion(data: response?.body, error: error); completion(data: response?.body, error: error);
} }
@ -524,7 +524,7 @@ public class PetAPI: APIBase {
- parameter petId: (path) ID of pet that needs to be fetched - parameter petId: (path) ID of pet that needs to be fetched
- returns: Promise<InlineResponse200> - returns: Promise<InlineResponse200>
*/ */
public class func getPetByIdInObject(petId petId: Int) -> Promise<InlineResponse200> { public class func getPetByIdInObject(petId petId: Int64) -> Promise<InlineResponse200> {
let deferred = Promise<InlineResponse200>.pendingPromise() let deferred = Promise<InlineResponse200>.pendingPromise()
getPetByIdInObject(petId: petId) { data, error in getPetByIdInObject(petId: petId) { data, error in
if let error = error { if let error = error {
@ -542,52 +542,52 @@ public class PetAPI: APIBase {
- GET /pet/{petId}?response=inline_arbitrary_object - GET /pet/{petId}?response=inline_arbitrary_object
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - 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: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth
- examples: [{example={ - API Key:
"id" : 123456789, - type: apiKey api_key
"tags" : [ { - name: api_key
"id" : 123456789, - examples: [{contentType=application/json, example={
"name" : "aeiou" "photoUrls" : [ "aeiou" ],
} ],
"category" : "{}",
"status" : "aeiou",
"name" : "doggie", "name" : "doggie",
"photoUrls" : [ "aeiou" ] "id" : 123456789,
}, contentType=application/json}, {example=<null> "category" : "{}",
"tags" : [ {
"name" : "aeiou",
"id" : 123456789
} ],
"status" : "aeiou"
}}, {contentType=application/xml, example=<null>
<photoUrls>string</photoUrls>
<name>doggie</name>
<id>123456</id> <id>123456</id>
<category>not implemented io.swagger.models.properties.ObjectProperty@37ff6855</category> <category>not implemented io.swagger.models.properties.ObjectProperty@37ff6855</category>
<status>string</status> <status>string</status>
<name>doggie</name> </null>}]
<photoUrls>string</photoUrls> - examples: [{contentType=application/json, example={
</null>, contentType=application/xml}] "photoUrls" : [ "aeiou" ],
- examples: [{example={
"id" : 123456789,
"tags" : [ {
"id" : 123456789,
"name" : "aeiou"
} ],
"category" : "{}",
"status" : "aeiou",
"name" : "doggie", "name" : "doggie",
"photoUrls" : [ "aeiou" ] "id" : 123456789,
}, contentType=application/json}, {example=<null> "category" : "{}",
"tags" : [ {
"name" : "aeiou",
"id" : 123456789
} ],
"status" : "aeiou"
}}, {contentType=application/xml, example=<null>
<photoUrls>string</photoUrls>
<name>doggie</name>
<id>123456</id> <id>123456</id>
<category>not implemented io.swagger.models.properties.ObjectProperty@37ff6855</category> <category>not implemented io.swagger.models.properties.ObjectProperty@37ff6855</category>
<status>string</status> <status>string</status>
<name>doggie</name> </null>}]
<photoUrls>string</photoUrls>
</null>, contentType=application/xml}]
- parameter petId: (path) ID of pet that needs to be fetched - parameter petId: (path) ID of pet that needs to be fetched
- returns: RequestBuilder<InlineResponse200> - returns: RequestBuilder<InlineResponse200>
*/ */
public class func getPetByIdInObjectWithRequestBuilder(petId petId: Int) -> RequestBuilder<InlineResponse200> { public class func getPetByIdInObjectWithRequestBuilder(petId petId: Int64) -> RequestBuilder<InlineResponse200> {
var path = "/pet/{petId}?response=inline_arbitrary_object" var path = "/pet/{petId}?response=inline_arbitrary_object"
path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil) path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path let URLString = PetstoreClientAPI.basePath + path
@ -607,7 +607,7 @@ public class PetAPI: APIBase {
- parameter petId: (path) ID of pet that needs to be fetched - parameter petId: (path) ID of pet that needs to be fetched
- parameter completion: completion handler to receive the data and the error objects - parameter completion: completion handler to receive the data and the error objects
*/ */
public class func petPetIdtestingByteArraytrueGet(petId petId: Int, completion: ((data: String?, error: ErrorType?) -> Void)) { public class func petPetIdtestingByteArraytrueGet(petId petId: Int64, completion: ((data: String?, error: ErrorType?) -> Void)) {
petPetIdtestingByteArraytrueGetWithRequestBuilder(petId: petId).execute { (response, error) -> Void in petPetIdtestingByteArraytrueGetWithRequestBuilder(petId: petId).execute { (response, error) -> Void in
completion(data: response?.body, error: error); completion(data: response?.body, error: error);
} }
@ -620,7 +620,7 @@ public class PetAPI: APIBase {
- parameter petId: (path) ID of pet that needs to be fetched - parameter petId: (path) ID of pet that needs to be fetched
- returns: Promise<String> - returns: Promise<String>
*/ */
public class func petPetIdtestingByteArraytrueGet(petId petId: Int) -> Promise<String> { public class func petPetIdtestingByteArraytrueGet(petId petId: Int64) -> Promise<String> {
let deferred = Promise<String>.pendingPromise() let deferred = Promise<String>.pendingPromise()
petPetIdtestingByteArraytrueGet(petId: petId) { data, error in petPetIdtestingByteArraytrueGet(petId: petId) { data, error in
if let error = error { if let error = error {
@ -638,20 +638,20 @@ public class PetAPI: APIBase {
- GET /pet/{petId}?testing_byte_array=true - GET /pet/{petId}?testing_byte_array=true
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - 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: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth
- examples: [{example="", contentType=application/json}, {example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e, contentType=application/xml}] - API Key:
- examples: [{example="", contentType=application/json}, {example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e, contentType=application/xml}] - 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 - parameter petId: (path) ID of pet that needs to be fetched
- returns: RequestBuilder<String> - returns: RequestBuilder<String>
*/ */
public class func petPetIdtestingByteArraytrueGetWithRequestBuilder(petId petId: Int) -> RequestBuilder<String> { public class func petPetIdtestingByteArraytrueGetWithRequestBuilder(petId petId: Int64) -> RequestBuilder<String> {
var path = "/pet/{petId}?testing_byte_array=true" var path = "/pet/{petId}?testing_byte_array=true"
path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil) path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path let URLString = PetstoreClientAPI.basePath + path
@ -798,7 +798,7 @@ public class PetAPI: APIBase {
- parameter _file: (form) file to upload (optional) - parameter _file: (form) file to upload (optional)
- parameter completion: completion handler to receive the data and the error objects - parameter completion: completion handler to receive the data and the error objects
*/ */
public class func uploadFile(petId petId: Int, additionalMetadata: String?, _file: NSURL?, completion: ((error: ErrorType?) -> Void)) { public class func uploadFile(petId petId: Int64, additionalMetadata: String?, _file: NSURL?, completion: ((error: ErrorType?) -> Void)) {
uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, _file: _file).execute { (response, error) -> Void in uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, _file: _file).execute { (response, error) -> Void in
completion(error: error); completion(error: error);
} }
@ -813,7 +813,7 @@ public class PetAPI: APIBase {
- parameter _file: (form) file to upload (optional) - parameter _file: (form) file to upload (optional)
- returns: Promise<Void> - returns: Promise<Void>
*/ */
public class func uploadFile(petId petId: Int, additionalMetadata: String?, _file: NSURL?) -> Promise<Void> { public class func uploadFile(petId petId: Int64, additionalMetadata: String?, _file: NSURL?) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise() let deferred = Promise<Void>.pendingPromise()
uploadFile(petId: petId, additionalMetadata: additionalMetadata, _file: _file) { error in uploadFile(petId: petId, additionalMetadata: additionalMetadata, _file: _file) { error in
if let error = error { if let error = error {
@ -841,7 +841,7 @@ public class PetAPI: APIBase {
- returns: RequestBuilder<Void> - returns: RequestBuilder<Void>
*/ */
public class func uploadFileWithRequestBuilder(petId petId: Int, additionalMetadata: String?, _file: NSURL?) -> RequestBuilder<Void> { public class func uploadFileWithRequestBuilder(petId petId: Int64, additionalMetadata: String?, _file: NSURL?) -> RequestBuilder<Void> {
var path = "/pet/{petId}/uploadImage" var path = "/pet/{petId}/uploadImage"
path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil) path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path let URLString = PetstoreClientAPI.basePath + path

View File

@ -111,36 +111,36 @@ public class StoreAPI: APIBase {
- API Key: - API Key:
- type: apiKey x-test_api_client_secret - type: apiKey x-test_api_client_secret
- name: test_api_client_secret - name: test_api_client_secret
- examples: [{example=[ { - examples: [{contentType=application/json, example=[ {
"id" : 123456789,
"petId" : 123456789, "petId" : 123456789,
"complete" : true,
"status" : "aeiou",
"quantity" : 123, "quantity" : 123,
"shipDate" : "2000-01-23T04:56:07.000+0000" "id" : 123456789,
} ], contentType=application/json}, {example=<Order> "shipDate" : "2000-01-23T04:56:07.000+0000",
"complete" : true,
"status" : "aeiou"
} ]}, {contentType=application/xml, example=<Order>
<id>123456</id> <id>123456</id>
<petId>123456</petId> <petId>123456</petId>
<quantity>0</quantity> <quantity>0</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate> <shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>string</status> <status>string</status>
<complete>true</complete> <complete>true</complete>
</Order>, contentType=application/xml}] </Order>}]
- examples: [{example=[ { - examples: [{contentType=application/json, example=[ {
"id" : 123456789,
"petId" : 123456789, "petId" : 123456789,
"complete" : true,
"status" : "aeiou",
"quantity" : 123, "quantity" : 123,
"shipDate" : "2000-01-23T04:56:07.000+0000" "id" : 123456789,
} ], contentType=application/json}, {example=<Order> "shipDate" : "2000-01-23T04:56:07.000+0000",
"complete" : true,
"status" : "aeiou"
} ]}, {contentType=application/xml, example=<Order>
<id>123456</id> <id>123456</id>
<petId>123456</petId> <petId>123456</petId>
<quantity>0</quantity> <quantity>0</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate> <shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>string</status> <status>string</status>
<complete>true</complete> <complete>true</complete>
</Order>, contentType=application/xml}] </Order>}]
- parameter status: (query) Status value that needs to be considered for query (optional, default to placed) - parameter status: (query) Status value that needs to be considered for query (optional, default to placed)
@ -166,7 +166,7 @@ public class StoreAPI: APIBase {
- parameter completion: completion handler to receive the data and the error objects - parameter completion: completion handler to receive the data and the error objects
*/ */
public class func getInventory(completion: ((data: [String:Int]?, error: ErrorType?) -> Void)) { public class func getInventory(completion: ((data: [String:Int32]?, error: ErrorType?) -> Void)) {
getInventoryWithRequestBuilder().execute { (response, error) -> Void in getInventoryWithRequestBuilder().execute { (response, error) -> Void in
completion(data: response?.body, error: error); completion(data: response?.body, error: error);
} }
@ -176,10 +176,10 @@ public class StoreAPI: APIBase {
Returns pet inventories by status Returns pet inventories by status
- returns: Promise<[String:Int]> - returns: Promise<[String:Int32]>
*/ */
public class func getInventory() -> Promise<[String:Int]> { public class func getInventory() -> Promise<[String:Int32]> {
let deferred = Promise<[String:Int]>.pendingPromise() let deferred = Promise<[String:Int32]>.pendingPromise()
getInventory() { data, error in getInventory() { data, error in
if let error = error { if let error = error {
deferred.reject(error) deferred.reject(error)
@ -199,23 +199,23 @@ public class StoreAPI: APIBase {
- API Key: - API Key:
- type: apiKey api_key - type: apiKey api_key
- name: api_key - name: api_key
- examples: [{example={ - examples: [{contentType=application/json, example={
"key" : 123 "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}]
- examples: [{example={ - examples: [{contentType=application/json, example={
"key" : 123 "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:Int]> - returns: RequestBuilder<[String:Int32]>
*/ */
public class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { public class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int32]> {
let path = "/store/inventory" let path = "/store/inventory"
let URLString = PetstoreClientAPI.basePath + path let URLString = PetstoreClientAPI.basePath + path
let nillableParameters: [String:AnyObject?] = [:] let nillableParameters: [String:AnyObject?] = [:]
let parameters = APIHelper.rejectNil(nillableParameters) let parameters = APIHelper.rejectNil(nillableParameters)
let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() let requestBuilder: RequestBuilder<[String:Int32]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "GET", URLString: URLString, parameters: parameters, isBody: true) return requestBuilder.init(method: "GET", URLString: URLString, parameters: parameters, isBody: true)
} }
@ -259,8 +259,8 @@ public class StoreAPI: APIBase {
- API Key: - API Key:
- type: apiKey api_key - type: apiKey api_key
- name: api_key - name: api_key
- 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: [{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}]
- returns: RequestBuilder<AnyObject> - returns: RequestBuilder<AnyObject>
*/ */
@ -314,42 +314,42 @@ public class StoreAPI: APIBase {
- GET /store/order/{orderId} - GET /store/order/{orderId}
- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - 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: - API Key:
- type: apiKey test_api_key_query (QUERY) - type: apiKey test_api_key_query (QUERY)
- name: test_api_key_query - name: test_api_key_query
- examples: [{example={ - API Key:
"id" : 123456789, - type: apiKey test_api_key_header
- name: test_api_key_header
- examples: [{contentType=application/json, example={
"petId" : 123456789, "petId" : 123456789,
"complete" : true,
"status" : "aeiou",
"quantity" : 123, "quantity" : 123,
"shipDate" : "2000-01-23T04:56:07.000+0000" "id" : 123456789,
}, contentType=application/json}, {example=<Order> "shipDate" : "2000-01-23T04:56:07.000+0000",
"complete" : true,
"status" : "aeiou"
}}, {contentType=application/xml, example=<Order>
<id>123456</id> <id>123456</id>
<petId>123456</petId> <petId>123456</petId>
<quantity>0</quantity> <quantity>0</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate> <shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>string</status> <status>string</status>
<complete>true</complete> <complete>true</complete>
</Order>, contentType=application/xml}] </Order>}]
- examples: [{example={ - examples: [{contentType=application/json, example={
"id" : 123456789,
"petId" : 123456789, "petId" : 123456789,
"complete" : true,
"status" : "aeiou",
"quantity" : 123, "quantity" : 123,
"shipDate" : "2000-01-23T04:56:07.000+0000" "id" : 123456789,
}, contentType=application/json}, {example=<Order> "shipDate" : "2000-01-23T04:56:07.000+0000",
"complete" : true,
"status" : "aeiou"
}}, {contentType=application/xml, example=<Order>
<id>123456</id> <id>123456</id>
<petId>123456</petId> <petId>123456</petId>
<quantity>0</quantity> <quantity>0</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate> <shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>string</status> <status>string</status>
<complete>true</complete> <complete>true</complete>
</Order>, contentType=application/xml}] </Order>}]
- parameter orderId: (path) ID of pet that needs to be fetched - parameter orderId: (path) ID of pet that needs to be fetched
@ -412,36 +412,36 @@ public class StoreAPI: APIBase {
- API Key: - API Key:
- type: apiKey x-test_api_client_secret - type: apiKey x-test_api_client_secret
- name: test_api_client_secret - name: test_api_client_secret
- examples: [{example={ - examples: [{contentType=application/json, example={
"id" : 123456789,
"petId" : 123456789, "petId" : 123456789,
"complete" : true,
"status" : "aeiou",
"quantity" : 123, "quantity" : 123,
"shipDate" : "2000-01-23T04:56:07.000+0000" "id" : 123456789,
}, contentType=application/json}, {example=<Order> "shipDate" : "2000-01-23T04:56:07.000+0000",
"complete" : true,
"status" : "aeiou"
}}, {contentType=application/xml, example=<Order>
<id>123456</id> <id>123456</id>
<petId>123456</petId> <petId>123456</petId>
<quantity>0</quantity> <quantity>0</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate> <shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>string</status> <status>string</status>
<complete>true</complete> <complete>true</complete>
</Order>, contentType=application/xml}] </Order>}]
- examples: [{example={ - examples: [{contentType=application/json, example={
"id" : 123456789,
"petId" : 123456789, "petId" : 123456789,
"complete" : true,
"status" : "aeiou",
"quantity" : 123, "quantity" : 123,
"shipDate" : "2000-01-23T04:56:07.000+0000" "id" : 123456789,
}, contentType=application/json}, {example=<Order> "shipDate" : "2000-01-23T04:56:07.000+0000",
"complete" : true,
"status" : "aeiou"
}}, {contentType=application/xml, example=<Order>
<id>123456</id> <id>123456</id>
<petId>123456</petId> <petId>123456</petId>
<quantity>0</quantity> <quantity>0</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate> <shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>string</status> <status>string</status>
<complete>true</complete> <complete>true</complete>
</Order>, contentType=application/xml}] </Order>}]
- parameter body: (body) order placed for purchasing the pet (optional) - parameter body: (body) order placed for purchasing the pet (optional)

View File

@ -270,7 +270,7 @@ public class UserAPI: APIBase {
- GET /user/{username} - GET /user/{username}
- -
- examples: [{example={ - examples: [{contentType=application/json, example={
"id" : 1, "id" : 1,
"username" : "johnp", "username" : "johnp",
"firstName" : "John", "firstName" : "John",
@ -279,7 +279,7 @@ public class UserAPI: APIBase {
"password" : "-secret-", "password" : "-secret-",
"phone" : "0123456789", "phone" : "0123456789",
"userStatus" : 0 "userStatus" : 0
}, contentType=application/json}] }}]
- parameter username: (path) The name that needs to be fetched. Use user1 for testing. - parameter username: (path) The name that needs to be fetched. Use user1 for testing.
@ -338,8 +338,8 @@ public class UserAPI: APIBase {
- GET /user/login - GET /user/login
- -
- examples: [{example="aeiou", contentType=application/json}, {example=string, contentType=application/xml}] - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}]
- examples: [{example="aeiou", contentType=application/json}, {example=string, contentType=application/xml}] - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}]
- parameter username: (query) The user name for login (optional) - parameter username: (query) The user name for login (optional)
- parameter password: (query) The password for login in clear text (optional) - parameter password: (query) The password for login in clear text (optional)

View File

@ -19,6 +19,14 @@ extension Int: JSONEncodable {
func encodeToJSON() -> AnyObject { return self } func encodeToJSON() -> AnyObject { return self }
} }
extension Int32: JSONEncodable {
func encodeToJSON() -> AnyObject { return NSNumber(int: self) }
}
extension Int64: JSONEncodable {
func encodeToJSON() -> AnyObject { return NSNumber(longLong: self) }
}
extension Double: JSONEncodable { extension Double: JSONEncodable {
func encodeToJSON() -> AnyObject { return self } func encodeToJSON() -> AnyObject { return self }
} }

View File

@ -56,6 +56,12 @@ class Decoders {
static func decode<T>(clazz clazz: T.Type, source: AnyObject) -> T { static func decode<T>(clazz clazz: T.Type, source: AnyObject) -> T {
initialize() initialize()
if T.self is Int32.Type && source is NSNumber {
return source.intValue as! T;
}
if T.self is Int64.Type && source is NSNumber {
return source.longLongValue as! T;
}
if source is T { if source is T {
return source as! T return source as! T
} }
@ -132,7 +138,7 @@ class Decoders {
Decoders.addDecoder(clazz: Category.self) { (source: AnyObject) -> Category in Decoders.addDecoder(clazz: Category.self) { (source: AnyObject) -> Category in
let sourceDictionary = source as! [NSObject:AnyObject] let sourceDictionary = source as! [NSObject:AnyObject]
let instance = Category() let instance = Category()
instance.id = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["id"]) instance.id = Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"])
instance.name = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"]) instance.name = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"])
return instance return instance
} }
@ -146,12 +152,12 @@ class Decoders {
Decoders.addDecoder(clazz: InlineResponse200.self) { (source: AnyObject) -> InlineResponse200 in Decoders.addDecoder(clazz: InlineResponse200.self) { (source: AnyObject) -> InlineResponse200 in
let sourceDictionary = source as! [NSObject:AnyObject] let sourceDictionary = source as! [NSObject:AnyObject]
let instance = InlineResponse200() let instance = InlineResponse200()
instance.tags = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["tags"])
instance.id = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["id"])
instance.category = Decoders.decodeOptional(clazz: AnyObject.self, source: sourceDictionary["category"])
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"]) 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) ?? "")
return instance return instance
} }
@ -164,7 +170,7 @@ class Decoders {
Decoders.addDecoder(clazz: Model200Response.self) { (source: AnyObject) -> Model200Response in Decoders.addDecoder(clazz: Model200Response.self) { (source: AnyObject) -> Model200Response in
let sourceDictionary = source as! [NSObject:AnyObject] let sourceDictionary = source as! [NSObject:AnyObject]
let instance = Model200Response() let instance = Model200Response()
instance.name = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["name"]) instance.name = Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["name"])
return instance return instance
} }
@ -177,7 +183,7 @@ class Decoders {
Decoders.addDecoder(clazz: ModelReturn.self) { (source: AnyObject) -> ModelReturn in Decoders.addDecoder(clazz: ModelReturn.self) { (source: AnyObject) -> ModelReturn in
let sourceDictionary = source as! [NSObject:AnyObject] let sourceDictionary = source as! [NSObject:AnyObject]
let instance = ModelReturn() let instance = ModelReturn()
instance._return = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["return"]) instance._return = Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["return"])
return instance return instance
} }
@ -190,8 +196,8 @@ class Decoders {
Decoders.addDecoder(clazz: Name.self) { (source: AnyObject) -> Name in Decoders.addDecoder(clazz: Name.self) { (source: AnyObject) -> Name in
let sourceDictionary = source as! [NSObject:AnyObject] let sourceDictionary = source as! [NSObject:AnyObject]
let instance = Name() let instance = Name()
instance.name = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["name"]) instance.name = Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["name"])
instance.snakeCase = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["snake_case"]) instance.snakeCase = Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["snake_case"])
return instance return instance
} }
@ -204,9 +210,9 @@ class Decoders {
Decoders.addDecoder(clazz: Order.self) { (source: AnyObject) -> Order in Decoders.addDecoder(clazz: Order.self) { (source: AnyObject) -> Order in
let sourceDictionary = source as! [NSObject:AnyObject] let sourceDictionary = source as! [NSObject:AnyObject]
let instance = Order() let instance = Order()
instance.id = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["id"]) instance.id = Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"])
instance.petId = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["petId"]) instance.petId = Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["petId"])
instance.quantity = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["quantity"]) instance.quantity = Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["quantity"])
instance.shipDate = Decoders.decodeOptional(clazz: NSDate.self, source: sourceDictionary["shipDate"]) instance.shipDate = Decoders.decodeOptional(clazz: NSDate.self, source: sourceDictionary["shipDate"])
instance.status = Order.Status(rawValue: (sourceDictionary["status"] as? String) ?? "") instance.status = Order.Status(rawValue: (sourceDictionary["status"] as? String) ?? "")
instance.complete = Decoders.decodeOptional(clazz: Bool.self, source: sourceDictionary["complete"]) instance.complete = Decoders.decodeOptional(clazz: Bool.self, source: sourceDictionary["complete"])
@ -222,7 +228,7 @@ class Decoders {
Decoders.addDecoder(clazz: Pet.self) { (source: AnyObject) -> Pet in Decoders.addDecoder(clazz: Pet.self) { (source: AnyObject) -> Pet in
let sourceDictionary = source as! [NSObject:AnyObject] let sourceDictionary = source as! [NSObject:AnyObject]
let instance = Pet() let instance = Pet()
instance.id = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["id"]) instance.id = Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"])
instance.category = Decoders.decodeOptional(clazz: Category.self, source: sourceDictionary["category"]) instance.category = Decoders.decodeOptional(clazz: Category.self, source: sourceDictionary["category"])
instance.name = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"]) instance.name = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"])
instance.photoUrls = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["photoUrls"]) instance.photoUrls = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["photoUrls"])
@ -240,7 +246,7 @@ class Decoders {
Decoders.addDecoder(clazz: SpecialModelName.self) { (source: AnyObject) -> SpecialModelName in Decoders.addDecoder(clazz: SpecialModelName.self) { (source: AnyObject) -> SpecialModelName in
let sourceDictionary = source as! [NSObject:AnyObject] let sourceDictionary = source as! [NSObject:AnyObject]
let instance = SpecialModelName() let instance = SpecialModelName()
instance.specialPropertyName = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["$special[property.name]"]) instance.specialPropertyName = Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["$special[property.name]"])
return instance return instance
} }
@ -253,7 +259,7 @@ class Decoders {
Decoders.addDecoder(clazz: Tag.self) { (source: AnyObject) -> Tag in Decoders.addDecoder(clazz: Tag.self) { (source: AnyObject) -> Tag in
let sourceDictionary = source as! [NSObject:AnyObject] let sourceDictionary = source as! [NSObject:AnyObject]
let instance = Tag() let instance = Tag()
instance.id = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["id"]) instance.id = Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"])
instance.name = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"]) instance.name = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"])
return instance return instance
} }
@ -267,14 +273,14 @@ class Decoders {
Decoders.addDecoder(clazz: User.self) { (source: AnyObject) -> User in Decoders.addDecoder(clazz: User.self) { (source: AnyObject) -> User in
let sourceDictionary = source as! [NSObject:AnyObject] let sourceDictionary = source as! [NSObject:AnyObject]
let instance = User() let instance = User()
instance.id = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["id"]) instance.id = Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"])
instance.username = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["username"]) instance.username = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["username"])
instance.firstName = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["firstName"]) instance.firstName = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["firstName"])
instance.lastName = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["lastName"]) instance.lastName = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["lastName"])
instance.email = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["email"]) instance.email = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["email"])
instance.password = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["password"]) instance.password = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["password"])
instance.phone = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["phone"]) instance.phone = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["phone"])
instance.userStatus = Decoders.decodeOptional(clazz: Int.self, source: sourceDictionary["userStatus"]) instance.userStatus = Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["userStatus"])
return instance return instance
} }

View File

@ -10,7 +10,7 @@ import Foundation
public class Category: JSONEncodable { public class Category: JSONEncodable {
public var id: Int? public var id: Int64?
public var name: String? public var name: String?
@ -19,7 +19,7 @@ public class Category: JSONEncodable {
// MARK: JSONEncodable // MARK: JSONEncodable
func encodeToJSON() -> AnyObject { func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]() var nillableDictionary = [String:AnyObject?]()
nillableDictionary["id"] = self.id nillableDictionary["id"] = self.id?.encodeToJSON()
nillableDictionary["name"] = self.name nillableDictionary["name"] = self.name
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary return dictionary

View File

@ -16,13 +16,13 @@ public class InlineResponse200: JSONEncodable {
case Sold = "sold" case Sold = "sold"
} }
public var tags: [Tag]? public var photoUrls: [String]?
public var id: Int? public var name: String?
public var id: Int64?
public var category: AnyObject? public var category: AnyObject?
public var tags: [Tag]?
/** pet status in the store */ /** pet status in the store */
public var status: Status? public var status: Status?
public var name: String?
public var photoUrls: [String]?
public init() {} public init() {}
@ -30,12 +30,12 @@ public class InlineResponse200: JSONEncodable {
// MARK: JSONEncodable // MARK: JSONEncodable
func encodeToJSON() -> AnyObject { func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]() var nillableDictionary = [String:AnyObject?]()
nillableDictionary["tags"] = self.tags?.encodeToJSON()
nillableDictionary["id"] = self.id
nillableDictionary["category"] = self.category
nillableDictionary["status"] = self.status?.rawValue
nillableDictionary["name"] = self.name
nillableDictionary["photoUrls"] = self.photoUrls?.encodeToJSON() nillableDictionary["photoUrls"] = self.photoUrls?.encodeToJSON()
nillableDictionary["name"] = self.name
nillableDictionary["id"] = self.id?.encodeToJSON()
nillableDictionary["category"] = self.category
nillableDictionary["tags"] = self.tags?.encodeToJSON()
nillableDictionary["status"] = self.status?.rawValue
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary return dictionary
} }

View File

@ -10,7 +10,7 @@ import Foundation
public class Model200Response: JSONEncodable { public class Model200Response: JSONEncodable {
public var name: Int? public var name: Int32?
public init() {} public init() {}
@ -18,7 +18,7 @@ public class Model200Response: JSONEncodable {
// MARK: JSONEncodable // MARK: JSONEncodable
func encodeToJSON() -> AnyObject { func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]() var nillableDictionary = [String:AnyObject?]()
nillableDictionary["name"] = self.name nillableDictionary["name"] = self.name?.encodeToJSON()
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary return dictionary
} }

View File

@ -10,7 +10,7 @@ import Foundation
public class ModelReturn: JSONEncodable { public class ModelReturn: JSONEncodable {
public var _return: Int? public var _return: Int32?
public init() {} public init() {}
@ -18,7 +18,7 @@ public class ModelReturn: JSONEncodable {
// MARK: JSONEncodable // MARK: JSONEncodable
func encodeToJSON() -> AnyObject { func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]() var nillableDictionary = [String:AnyObject?]()
nillableDictionary["return"] = self._return nillableDictionary["return"] = self._return?.encodeToJSON()
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary return dictionary
} }

View File

@ -10,8 +10,8 @@ import Foundation
public class Name: JSONEncodable { public class Name: JSONEncodable {
public var name: Int? public var name: Int32?
public var snakeCase: Int? public var snakeCase: Int32?
public init() {} public init() {}
@ -19,8 +19,8 @@ public class Name: JSONEncodable {
// MARK: JSONEncodable // MARK: JSONEncodable
func encodeToJSON() -> AnyObject { func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]() var nillableDictionary = [String:AnyObject?]()
nillableDictionary["name"] = self.name nillableDictionary["name"] = self.name?.encodeToJSON()
nillableDictionary["snake_case"] = self.snakeCase nillableDictionary["snake_case"] = self.snakeCase?.encodeToJSON()
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary return dictionary
} }

View File

@ -16,9 +16,9 @@ public class Order: JSONEncodable {
case Delivered = "delivered" case Delivered = "delivered"
} }
public var id: Int? public var id: Int64?
public var petId: Int? public var petId: Int64?
public var quantity: Int? public var quantity: Int32?
public var shipDate: NSDate? public var shipDate: NSDate?
/** Order Status */ /** Order Status */
public var status: Status? public var status: Status?
@ -30,9 +30,9 @@ public class Order: JSONEncodable {
// MARK: JSONEncodable // MARK: JSONEncodable
func encodeToJSON() -> AnyObject { func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]() var nillableDictionary = [String:AnyObject?]()
nillableDictionary["id"] = self.id nillableDictionary["id"] = self.id?.encodeToJSON()
nillableDictionary["petId"] = self.petId nillableDictionary["petId"] = self.petId?.encodeToJSON()
nillableDictionary["quantity"] = self.quantity nillableDictionary["quantity"] = self.quantity?.encodeToJSON()
nillableDictionary["shipDate"] = self.shipDate?.encodeToJSON() nillableDictionary["shipDate"] = self.shipDate?.encodeToJSON()
nillableDictionary["status"] = self.status?.rawValue nillableDictionary["status"] = self.status?.rawValue
nillableDictionary["complete"] = self.complete nillableDictionary["complete"] = self.complete

View File

@ -16,7 +16,7 @@ public class Pet: JSONEncodable {
case Sold = "sold" case Sold = "sold"
} }
public var id: Int? public var id: Int64?
public var category: Category? public var category: Category?
public var name: String? public var name: String?
public var photoUrls: [String]? public var photoUrls: [String]?
@ -30,7 +30,7 @@ public class Pet: JSONEncodable {
// MARK: JSONEncodable // MARK: JSONEncodable
func encodeToJSON() -> AnyObject { func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]() var nillableDictionary = [String:AnyObject?]()
nillableDictionary["id"] = self.id nillableDictionary["id"] = self.id?.encodeToJSON()
nillableDictionary["category"] = self.category?.encodeToJSON() nillableDictionary["category"] = self.category?.encodeToJSON()
nillableDictionary["name"] = self.name nillableDictionary["name"] = self.name
nillableDictionary["photoUrls"] = self.photoUrls?.encodeToJSON() nillableDictionary["photoUrls"] = self.photoUrls?.encodeToJSON()

View File

@ -10,7 +10,7 @@ import Foundation
public class SpecialModelName: JSONEncodable { public class SpecialModelName: JSONEncodable {
public var specialPropertyName: Int? public var specialPropertyName: Int64?
public init() {} public init() {}
@ -18,7 +18,7 @@ public class SpecialModelName: JSONEncodable {
// MARK: JSONEncodable // MARK: JSONEncodable
func encodeToJSON() -> AnyObject { func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]() var nillableDictionary = [String:AnyObject?]()
nillableDictionary["$special[property.name]"] = self.specialPropertyName nillableDictionary["$special[property.name]"] = self.specialPropertyName?.encodeToJSON()
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary return dictionary
} }

View File

@ -10,7 +10,7 @@ import Foundation
public class Tag: JSONEncodable { public class Tag: JSONEncodable {
public var id: Int? public var id: Int64?
public var name: String? public var name: String?
@ -19,7 +19,7 @@ public class Tag: JSONEncodable {
// MARK: JSONEncodable // MARK: JSONEncodable
func encodeToJSON() -> AnyObject { func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]() var nillableDictionary = [String:AnyObject?]()
nillableDictionary["id"] = self.id nillableDictionary["id"] = self.id?.encodeToJSON()
nillableDictionary["name"] = self.name nillableDictionary["name"] = self.name
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary return dictionary

View File

@ -10,7 +10,7 @@ import Foundation
public class User: JSONEncodable { public class User: JSONEncodable {
public var id: Int? public var id: Int64?
public var username: String? public var username: String?
public var firstName: String? public var firstName: String?
public var lastName: String? public var lastName: String?
@ -18,7 +18,7 @@ public class User: JSONEncodable {
public var password: String? public var password: String?
public var phone: String? public var phone: String?
/** User Status */ /** User Status */
public var userStatus: Int? public var userStatus: Int32?
public init() {} public init() {}
@ -26,14 +26,14 @@ public class User: JSONEncodable {
// MARK: JSONEncodable // MARK: JSONEncodable
func encodeToJSON() -> AnyObject { func encodeToJSON() -> AnyObject {
var nillableDictionary = [String:AnyObject?]() var nillableDictionary = [String:AnyObject?]()
nillableDictionary["id"] = self.id nillableDictionary["id"] = self.id?.encodeToJSON()
nillableDictionary["username"] = self.username nillableDictionary["username"] = self.username
nillableDictionary["firstName"] = self.firstName nillableDictionary["firstName"] = self.firstName
nillableDictionary["lastName"] = self.lastName nillableDictionary["lastName"] = self.lastName
nillableDictionary["email"] = self.email nillableDictionary["email"] = self.email
nillableDictionary["password"] = self.password nillableDictionary["password"] = self.password
nillableDictionary["phone"] = self.phone nillableDictionary["phone"] = self.phone
nillableDictionary["userStatus"] = self.userStatus nillableDictionary["userStatus"] = self.userStatus?.encodeToJSON()
let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary return dictionary
} }

View File

@ -59,6 +59,11 @@
"idiom" : "ipad", "idiom" : "ipad",
"size" : "76x76", "size" : "76x76",
"scale" : "2x" "scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
} }
], ],
"info" : { "info" : {